Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
i decided to try figure out how to save easily then item raw codes for a catalog system, so i did a very easy map what save every item raw code and id code into text file (wc3\ItemToTXT\itemtotxt.txt)what was place to ground in WE.
i inserted a example function to gui users, they need only copy then header and place 1 custom script to map init or where they want for load the item types.
1. - Item raw code and id store to variable with item name with only placeing item to ground in map editor and starting map.
Why better this than save the item id? raw code shorter...
why better use array for list the items? because save load code for items will be half than with raw code or 4x lower if u use less item (70-80)
why save this to text file? because still easier use 2x replace in notepad then copy paste than type manually itemid[1]='ward', itemid[2]='stel' etc
but who want then can use directly the funtion from header and its load automatically all wc3 item what (non power up or tome[exp, power etc]) to variables than even in gui u can search between them easily since variable is also gui.
function Chr2Asc takes integer chr returns string
local string s = "0123456789#######ABCDEFGHIJKLMNOPQRSTUVWXYZ######abcdefghijklmnopqrstuvwxyz"
if chr > 47 and chr < 123 then
return SubString(s, chr - 48, chr - 47)
else
return "#"
endif
endfunction
function Asc2Chr takes string asc returns integer
local string s = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
local integer l = StringLength(s)
local integer i = 0
local integer chr = - 1
loop
exitwhen i == l - 1 or chr != - 1
if SubString(s, i, i + 1) == asc then
if i < 10 then
set chr = i + 48
elseif i < 36 then
set chr = i + 55
else
set chr = i + 61
endif
endif
set i = i + 1
endloop
return chr
endfunction
function ItemId2RawCode takes integer id returns string
local integer a1
local integer a2
local integer a3
local integer a4
set a1 = id / (256 * 256 * 256)
set id = id - (a1 * 256 * 256 * 256)
set a2 = id / (256 * 256)
set id = id - (a2 * 256 * 256)
set a3 = id / 256
set id = id - (a3 * 256)
set a4 = id
return (Chr2Asc(a1) + Chr2Asc(a2) + Chr2Asc(a3) + Chr2Asc(a4))
endfunction
function SaveItemToTxT takes nothing returns nothing
local integer Id
local item Itm = GetEnumItem()
local itemtype Itype = GetItemType(Itm)
local string s
local string Ic
if (Itype != ITEM_TYPE_POWERUP) then
if (Itype == ITEM_TYPE_CHARGED) then
set Ic = " (" + I2S(GetItemCharges(Itm)) + ")"
else
set Ic = ""
endif
set Id = GetItemTypeId (Itm)
set s = "set i[" + I2S(udg_I) + "] = '" + ItemId2RawCode(Id) + "' O9APT7" + GetItemName(Itm) + Ic + " id:" + I2S(Id)
call Preload(s)
call RemoveItem( Itm )
endif
set udg_I = udg_I + 1
set Ic = null
set s = null
set Itm = null
set Itype = null
endfunction
function Trig_Save_all_item_to_txt_Actions takes nothing returns nothing
set udg_I = 0
call PreloadGenClear()
call PreloadGenStart()
call EnumItemsInRect(GetPlayableMapRect(), null, function SaveItemToTxT)
call Preload("set iMax="+I2S(udg_I-1))
call PreloadGenEnd("ItemToTXT\\itemtotxt.txt")
call DisplayTextToForce( GetPlayersAll(), "All non power up saved to |cff9999ffItemToTxt\\itemtotxt.txt|r" )
endfunction
//===========================================================================
function InitTrig_Save_all_item_to_txt takes nothing returns nothing
set gg_trg_Save_all_item_to_txt = CreateTrigger( )
call TriggerAddAction( gg_trg_Save_all_item_to_txt, function Trig_Save_all_item_to_txt_Actions )
endfunction
Code:
set i[0] = 'pams' //Anti-magic Potion id:1885433203
set i[1] = 'gvsm' //Gloves of Spell Mastery id:1735816045
set i[2] = 'gobm' //Goblin Land Mines id:1735352941
set i[3] = 'gemt' //Gem of True Seeing id:1734700404
set i[4] = 'cosl' //Celestial Orb of Souls id:1668248428
set i[5] = 'brag' //Bracer of Agility id:1651663207
set i[6] = 'blba' //Bladebane Armor id:1651270241
set i[7] = 'bfhr' //Bloodfeather's Heart id:1650878578
set i[8] = 'asbl' //Assassin's Blade id:1634951788
set i[9] = 'arsh' //Arcanite Shield id:1634890600
set i[10] = 'arsc' //Arcane Scroll id:1634890595
set i[11] = 'wolg' //Wirt's Other Leg id:2003790951
set i[12] = 'shen' //Enchanted Shield id:1936221550
set i[13] = 'rat3' //Claws of Attack +3 id:1918989363
set i[14] = 'dust' //Dust of Appearance id:1685418868
set i[15] = 'dtsb' //Drek'thar's Spellbook id:1685353314
set i[16] = 'drph' //Druid Pouch id:1685221480
set i[17] = 'crdt' //Crown of the Deathlord id:1668441204
set i[18] = 'axas' //Ancestral Staff id:1635279219
set i[19] = 'anfg' //Ancient Figurine id:1634625127
set i[20] = 'amrc' //Amulet of Recall id:1634562659
set i[21] = 'tsct' //Ivory Tower id:1953719156
set i[22] = 'rde1' //Ring of Protection +2 id:1919182129
set i[23] = 'prvt' //Periapt of Vitality id:1886549620
set i[24] = 'pmna' //Pendant of Mana id:1886219873
set i[25] = 'plcl' //Lesser Clarity Potion id:1886151532
set i[26] = 'penr' //Pendant of Energy id:1885695602
set i[27] = 'moon' //Moonstone id:1836019566
set i[28] = 'mcri' //Mechanical Critter id:1835233897
set i[29] = 'hslv' //Healing Salve id:1752394870
set i[30] = 'tels' //Goblin Night Scope id:1952803955
set i[31] = 'sor4' //Shadow Orb +4 id:1936683572
set i[32] = 'tmsc' //Tome of Sacrifices id:1953330019
set i[33] = 'tmmt' //Totem of Might id:1953328500
set i[34] = 'srtl' //Serathil id:1936880748
set i[35] = 'srbd' //Searing Blade id:1936876132
set i[36] = 'sora' //Shadow Orb +10 id:1936683617
set i[37] = 'sor9' //Shadow Orb +9 id:1936683577
set i[38] = 'sor8' //Shadow Orb +8 id:1936683576
set i[39] = 'sor7' //Shadow Orb +7 id:1936683575
set i[40] = 'sor6' //Shadow Orb +6 id:1936683574
set i[41] = 'sor5' //Shadow Orb +5 id:1936683573
set i[42] = 'sor3' //Shadow Orb +3 id:1936683571
set i[43] = 'sor2' //Shadow Orb +2 id:1936683570
set i[44] = 'sor1' //Shadow Orb +1 id:1936683569
set i[45] = 'shcw' //Shaman Claws id:1936221047
set i[46] = 'sfog' //Horn of the Clouds id:1936093031
set i[47] = 'rej6' //Greater Scroll of Replenishment id:1919248950
set i[48] = 'rej4' //Greater Replenishment Potion id:1919248948
set i[49] = 'hbth' //Helm of Battlethirst id:1751282792
set i[50] = 'grsl' //Grimoire of Souls id:1735553900
set i[51] = 'fwss' //Frost Wyrm Skull Shield id:1719104371
set i[52] = 'frgd' //Frostguard id:1718773604
set i[53] = 'wtlg' //Wirt's Leg id:2004118631
set i[54] = 'sehr' //The Heart of Searinox id:1936025714
set i[55] = 'scul' //Scroll of the Unholy Legion id:1935897964
set i[56] = 'schl' //Scepter of Healing id:1935894636
set i[57] = 'rej5' //Lesser Scroll of Replenishment id:1919248949
set i[58] = 'rej2' //Lesser Replenishment Potion id:1919248946
set i[59] = 'rej1' //Minor Replenishment Potion id:1919248945
set i[60] = 'nspi' //Necklace of Spell Immunity id:1853059177
set i[61] = 'mnsf' //Mindstaff id:1835955046
set i[62] = 'mlst' //Maul of Strength id:1835823988
set i[63] = 'lure' //Monster Lure id:1819636325
set i[64] = 'ktrm' //Urn of King Terenas id:1802793581
set i[65] = 'klmm' //Killmaim id:1802268013
set i[66] = 'kgal' //Keg of Ale id:1801937260
set i[67] = 'jdrn' //Jade Ring id:1784967790
set i[68] = 'iwbr' //Ironwood Branch id:1769431666
set i[69] = 'horl' //Sacred Relic id:1752134252
set i[70] = 'frhg' //Firehand Gauntlets id:1718773863
set i[71] = 'fgun' //Flare Gun id:1718056302
set i[72] = 'esaz' //Essence of Aszune id:1702060410
set i[73] = 'envl' //Enchanted Vial id:1701738092
set i[74] = 'ccmd' //Scepter of Mastery id:1667460452
set i[75] = 'rlif' //Ring of Regeneration id:1919707494
set i[76] = 'rin1' //Mantle of Intelligence +3 id:1919512113
set i[77] = 'rde4' //Ring of Protection +5 id:1919182132
set i[78] = 'rde3' //Ring of Protection +4 id:1919182131
set i[79] = 'rde2' //Ring of Protection +3 id:1919182130
set i[80] = 'pnvl' //Potion of Lesser Invulnerability id:1886287468
set i[81] = 'pman' //Potion of Mana id:1886216558
set i[82] = 'pinv' //Potion of Invisibility id:1885957750
set i[83] = 'phea' //Potion of Healing id:1885889889
set i[84] = 'pclr' //Clarity Potion id:1885564018
set i[85] = 'ofro' //Orb of Frost id:1868984943
set i[86] = 'odef' //Orb of Darkness id:1868850534
set i[87] = 'modt' //Mask of Death id:1836016756
set i[88] = 'mcou' //Medallion of Courage id:1835233141
set i[89] = 'lgdh' //Legion Doom-Horn id:1818715240
set i[90] = 'ciri' //Robe of the Magi +6 id:1667854953
set i[91] = 'vddl' //Voodoo Doll id:1986290796
set i[92] = 'sksh' //Skull Shield id:1936421736
set i[93] = 'shtm' //Shamanic Totem id:1936225389
set i[94] = 'shrs' //Shimmerglaze Roast id:1936224883
set i[95] = 'shhn' //Shield of Honor id:1936222318
set i[96] = 'shdt' //Shield of the Deathlord id:1936221300
set i[97] = 'rump' //Rusty Mining Pick id:1920298352
set i[98] = 'rots' //Scepter of the Sea id:1919906931
set i[99] = 'soul' //Soul id:1936684396
set i[100] = 'skul' //Sacrificial Skull id:1936422252
set i[101] = 'skrt' //Skeletal Artifact id:1936421492
set i[102] = 'rugt' //Runed Gauntlets id:1920296820
set i[103] = 'rnsp' //Ring of Superiority id:1919841136
set i[104] = 'rde0' //Ring of Protection +1 id:1919182128
set i[105] = 'ram3' //Ring of the Archmagi id:1918987571
set i[106] = 'ram2' //Ring of the Archmagi id:1918987570
set i[107] = 'ram1' //Ring of the Archmagi id:1918987569
set i[108] = 'pspd' //Potion of Speed id:1886613604
set i[109] = 'pgin' //Potion of Greater Invisibility id:1885825390
set i[110] = 'oven' //Orb of Venom id:1870030190
set i[111] = 'oslo' //Orb of Slow id:1869835375
set i[112] = 'olig' //Orb of Lightning id:1869375847
set i[113] = 'oli2' //Orb of Lightning id:1869375794
set i[114] = 'ofir' //Orb of Fire id:1868982642
set i[115] = 'ocor' //Orb of Corruption id:1868787570
set i[116] = 'lnrn' //Lion's Ring id:1819177582
set i[117] = 'kysn' //Sun Key id:1803121518
set i[118] = 'glsk' //Skull of Gul'dan id:1735160683
set i[119] = 'gldo' //Orb of Kil'jaeden id:1735156847
set i[120] = 'wcyc' //Wand of the Wind (3) id:2003007843
set i[121] = 'sman' //Scroll of Mana id:1936548206
set i[122] = 'shea' //Scroll of Healing id:1936221537
set i[123] = 'sbch' //Scourge Bone Chimes id:1935827816
set i[124] = 'rwiz' //Sobi Mask id:1920428410
set i[125] = 'rnec' //Rod of Necromancy id:1919837539
set i[126] = 'rhth' //Khadgar's Gem of Health id:1919448168
set i[127] = 'ratf' //Claws of Attack +15 id:1918989414
set i[128] = 'rag1' //Slippers of Agility +3 id:1918986033
set i[129] = 'kpin' //Khadgar's Pipe of Insight id:1802529134
set i[130] = 'hval' //Helm of Valor id:1752588652
set i[131] = 'hcun' //Hood of Cunning id:1751348590
set i[132] = 'desc' //Kelen's Dagger of Escape id:1684370275
set i[133] = 'ckng' //Crown of Kings +5 id:1667984999
set i[134] = 'brac' //Runed Bracers id:1651663203
set i[135] = 'tlum' //Tiny Lumber Mill id:1953265005
set i[136] = 'thdm' //Thunderlizard Diamond id:1952998509
set i[137] = 'tfar' //Tiny Farm id:1952866674
set i[138] = 'tbsm' //Tiny Blacksmith id:1952609133
set i[139] = 'tbar' //Tiny Barracks id:1952604530
set i[140] = 'tbak' //Tiny Altar of Kings id:1952604523
set i[141] = 'stwa' //Sturdy War Axe id:1937012577
set i[142] = 'stre' //Staff of Reanimation id:1937011301
set i[143] = 'sprn' //Spider Ring id:1936749166
set i[144] = 'spre' //Staff of Preservation id:1936749157
set i[145] = 'sbok' //Spell Book id:1935830891
set i[146] = 'ram4' //Ring of the Archmagi id:1918987572
set i[147] = 'phlt' //Phat Lewt id:1885891700
set i[148] = 'k3m2' //Partial Key of the Three Moons id:1798532402
set i[149] = 'k3m1' //Mooncrystal id:1798532401
set i[150] = 'jpnt' //Note to Jaina Proudmoore id:1785753204
set i[151] = 'gsou' //Soul Gem id:1735618421
set i[152] = 'wshs' //Wand of Shadowsight (2) id:2004052083
set i[153] = 'woms' //Wand of Mana Stealing (2) id:2003791219
set i[154] = 'wlsd' //Wand of Lightning Shield (3) id:2003596132
set i[155] = 'ward' //Warsong Battle Drums id:2002874980
set i[156] = 'stel' //Staff of Teleportation id:1937007980
set i[157] = 'ssil' //Staff of Silence id:1936943468
set i[158] = 'sreg' //Scroll of Regeneration id:1936876903
set i[159] = 'spro' //Scroll of Protection id:1936749167
set i[160] = 'shas' //Scroll of Speed id:1936220531
set i[161] = 'rst1' //Gauntlets of Ogre Strength +3 id:1920169009
set i[162] = 'lhst' //The Lion Horn of Stormwind id:1818784628
set i[163] = 'gcel' //Gloves of Haste id:1734567276
set i[164] = 'evtl' //Talisman of Evasion id:1702261868
set i[165] = 'dsum' //Diamond of Summoning id:1685288301
set i[166] = 'mort' //Mogrin's Report id:1836020340
set i[167] = 'mgtk' //Magic Key Chain id:1835496555
set i[168] = 'kymn' //Moon Key id:1803119982
set i[169] = 'k3m3' //Key of Three Moons id:1798532403
set i[170] = 'will' //Wand of Illusion (3) id:2003397740
set i[171] = 'wild' //Amulet of the Wild (1) id:2003397732
set i[172] = 'totw' //Talisman of the Wild (3) id:1953461367
set i[173] = 'stwp' //Scroll of Town Portal id:1937012592
set i[174] = 'ssan' //Staff of Sanctuary id:1936941422
set i[175] = 'sneg' //Staff of Negation id:1936614759
set i[176] = 'silk' //Spider Silk Broach id:1936288875
set i[177] = 'rat9' //Claws of Attack +9 id:1918989369
set i[178] = 'fgsk' //Book of the Dead (1) id:1718055787
set i[179] = 'fgrg' //Stone Token (1) id:1718055527
set i[180] = 'fgfh' //Spiked Collar (1) id:1718052456
set i[181] = 'fgdg' //Demonic Figurine (1) id:1718051943
set i[182] = 'crys' //Crystal Ball id:1668446579
set i[183] = 'clsd' //Cloak of Shadows id:1668051812
set i[184] = 'clfm' //Cloak of Flames id:1668048493
set i[185] = 'ankh' //Ankh of Reincarnation (1) id:1634626408
set i[186] = 'uflg' //Undead Flag id:1969646695
set i[187] = 'oflg' //Orc Flag id:1868983399
set i[188] = 'nflg' //Night Elf Flag id:1852206183
set i[189] = 'flag' //Human Flag id:1718378855
set i[190] = 'gopr' //Glyph of Purification id:1735356530
set i[191] = 'cnhn' //Horn of Cenarius id:1668180078
set i[192] = 'azhr' //Heart of Aszune id:1635412082
set i[193] = 'wswd' //Sentry Wards (3) id:2004055908
set i[194] = 'whwd' //Healing Wards (3) id:2003335012
set i[195] = 'vamp' //Vampiric Potion id:1986096496
set i[196] = 'tret' //Tome of Retraining id:1953654132
set i[197] = 'tgrh' //Tiny Great Hall id:1952936552
set i[198] = 'tcas' //Tiny Castle id:1952670067
set i[199] = 'srrc' //Scroll of Resurrection (1) id:1936880227
set i[200] = 'sror' //Scroll of the Beast (1) id:1936879474
set i[201] = 'shar' //Ice Shard (1) id:1936220530
set i[202] = 'ratc' //Claws of Attack +12 id:1918989411
set i[203] = 'rat6' //Claws of Attack +6 id:1918989366
set i[204] = 'infs' //Inferno Stone (1) id:1768842867
set i[205] = 'hlst' //Health Stone (1) id:1751937908
set i[206] = 'cnob' //Circlet of Nobility id:1668181858
set i[207] = 'stpg' //Clockwork Penguin id:1937010791
set i[208] = 'sorf' //Shadow Orb Fragment id:1936683622
set i[209] = 'btst' //Battle Standard id:1651798900
set i[210] = 'thle' //Thunder Lizard Egg id:1953000549
set i[211] = 'dthb' //Thunderbloom Bulb id:1685350498
set i[212] = 'dphe' //Thunder Phoenix Egg id:1685088357
set i[213] = 'ledg' //Gerard's Lost Ledger id:1818584167
set i[214] = 'kygh' //Ghost Key id:1803118440
set i[215] = 'gmfr' //Gem Fragment id:1735222898
set i[216] = 'wneu' //Wand of Neutralization id:2003723637
set i[217] = 'wneg' //Wand of Negation id:2003723623
set i[218] = 'sres' //Scroll of Restoration (1) id:1936876915
set i[219] = 'sand' //Scroll of Animate Dead (1) id:1935765092
set i[220] = 'rej3' //Replenishment Potion (1) id:1919248947
set i[221] = 'pgma' //Potion of Greater Mana (1) id:1885826401
set i[222] = 'pghe' //Potion of Greater Healing (1) id:1885825125
set i[223] = 'pdiv' //Potion of Divinity (1) id:1885628790
set i[224] = 'mnst' //Mana Stone (1) id:1835955060
set i[225] = 'kybl' //Blood Key id:1803117164
set i[226] = 'bspd' //Boots of Speed id:1651732580
set i[227] = 'bgst' //Belt of Giant Strength +6 id:1650946932
set i[228] = 'belv' //Boots of Quel'Thalas +6 id:1650814070
set i[229] = 'ajen' //Ancient Janggo of Endurance id:1634362734
set i[230] = 'shwd' //Shimmerweed id:1936226148
set i[231] = 'sclp' //Secret Level Powerup id:1935895664
set i[232] = 'engs' //Enchanted Gemstone id:1701734259
set i[233] = 'dkfw' //Keg of Thunderwater id:1684760183
set i[234] = 'bzbf' //Full Vial id:1652187750
set i[235] = 'spsh' //Amulet of Spell Shield id:1936749416
set i[236] = 'pres' //Potion of Restoration (1) id:1886545267
set i[237] = 'pomn' //Potion of Omniscience (1) id:1886350702
set i[238] = 'pnvu' //Potion of Invulnerability (1) id:1886287477
set i[239] = 'fgrd' //Red Drake Egg (1) id:1718055524
set i[240] = 'ches' //Cheese id:1667786099
set i[241] = 'bzbe' //Empty Vial id:1652187749
set i[242] = 'afac' //Alleria's Flute of Accuracy id:1634099555
2. - Randomize String
- you would ask why to randomize?
- answer could be if u bored with regular string for encrypt because too obvious if u put "b" instead the "a" then it is higher
- would be good for generate low check sum crap, if example your save load code want protect with additive way, so check each letter in save-load code and get position and add eachother from first scrambled encrypt code and do same with second encrypt code what was randomized, add the 2 result to each other and useally the result will be enough long for able save with 2 character at end of your save load code.
Why? if someone change values then increase or decrease the result and u compare if with result what was saved at end of the code
- random string will be saved to you wc3/logs/random.txt
function RandomizeString takes string t returns string
local string s = ""
local integer i = 0
local integer len = StringLength(t)
local integer c = len
local integer clen = 0
local string l = ""
if len > 2 then
loop
exitwhen StringLength(s) == c
set len = StringLength(t)
if len > 1 then
set i = GetRandomInt(0, len-1)
set l = SubString(t, i, i + 1)
if i < len then
if i == len-1 then
set s = s + l
set t = SubString(t, 0, len - 1)
elseif i == 0 then
set s = s + l
set t = SubString(t, 1, len)
else
set s = s + l
set t = SubString(t, 0, i) + SubString(t, i + 1, len)
endif
elseif i == len-1 then
set s = s + l
set t = SubString(t, 0, len - 1)
endif
else
set s = s + t
set t=""
endif
endloop
else
set s = t
endif
set l = null
set t = null
return s
endfunction
Keywords:
raw code, jass, gui, variables, item type, item id, save to file. randomized string, random, save load, code, encrypt, decode
12th Dec 2015
IcemanBo: Too long as NeedsFix. Rejected.
11:56, 19th Sep 2014
TriggerHappy:
I don't understand the point of this.
Why not just store every item into an integer array? Even then I'm not sure it's useful.
Can you explain...
well what u say have no point... why? i wrote only the saveing done nothing else, also map job is save to file the item raw code and id' with name and then with 2sec (useing 2 replace few part in notepad) and u got item type variables filled with every item.
What is the point in storeing item raw code into integer array? if you do save-load thing and use dont use items like me on my other map just regular items but alot from them then u dont need to type manually 1by1 the items, just copy and done.
Why better this than save the item id? raw code shorter...
why better use array for list the items? because save load code for items will be half than with raw code or 4x lower if u use less item (70-80)
why save this to text file? because still easier use 2x replace in notepad then copy paste than type manually itemid[1]='ward', itemid[2]='stel' etc
but who want then can use directly the funtion from header and its load automatically all wc3 item what (non power up or tome[exp, power etc]) to variables than even in gui u can search between them easily since variable is also gui.
like wrote above its reduce save load code greatly, like below 70-80 item just 1 letter in save load code (or even above too if u got restrictions) or if no restriction then below 5-6k item type 2 letter.
please read it, i wrote several times it is used to make fast a integer array for items, basically like a tool, make easier, instead of gui click a thousand times for set variable this save to file, change the variable name and copy what (atleast to me) made alot easier to make a integer array for items without spending minutes or in worst case hours for click madnessing
Why better this than save the item id? raw code shorter...
why better use array for list the items? because save load code for items will be half than with raw code or 4x lower if u use less item (70-80)
why save this to text file? because still easier use 2x replace in notepad then copy paste than type manually itemid[1]='ward', itemid[2]='stel' etc
but who want then can use directly the funtion from header and its load automatically all wc3 item what (non power up or tome[exp, power etc]) to variables than even in gui u can search between them easily since variable is also gui.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.