//TESH.scrollpos=-1
//TESH.alwaysfold=0
//*************************************************************************************************************************************************************************************
//
//
//
//
//
// Description of RPG Creator basic functions By Grabiti
//
// internal system function
//
// function ToNotation takes integer input returns string
// Converts the received decimal number to udg_keySet decimal.
//
// function ToInteger takes string input returns integer
// Converts the received udg_keySet decimal number to decimal number.
//
// function ToNotation2 takes integer input returns string
// Converts the received decimal number to binary.
//
// function ToInteger2 takes string input returns integer
// Converts the received binary number to decimal.
//
// function CodeLength takes string input, integer notation returns string
// Returns the value that fills in the blank spaces of the passed n number. (Function to match the number of digits in the code)
//
// function CodeLength2 takes string input, integer maxLength returns string
// Returns the value filled with spaces in the passed binary number. (Function to match the number of digits in the code)
//
// function NameToInteger takes string name returns integer
// Integerizes the received string.
//
// function IsNumber takes string input returns boolean
// Check whether the received character is a number.
//
// function IsSpecial takes string input returns boolean
// Check whether the received text is a special character.
//
// function IsSmallAlphabet takes string input returns boolean
// Check whether the received letters are lowercase.
//
// function IsSmallAlphabet takes string input returns boolean
// Check whether the received letters are lowercase.
//
// function CodeColor takes string input returns string
// Color the received code.
//
// function PrintCode takes player p, string saveResult, integer codeLine returns string
// Print a code to the player.
//
// function HashSetting takes nothing returns nothing
// The object set in the setup Hero Item trigger is stored in the hash table.
//
// function MakeFile takes player p, string fileName, string string1, string string2, string string3, string string4 returns nothing
// Save the text file as an external file.
//
// function DataOnBoolean takes integer loopA returns boolean
// Returns true if the passed number is an array of code length values ??or an array of encryption values, otherwise returns false.
//
// function SaveDataHash takes player p returns nothing
// When saving, the udg_data variables set in the Save trigger are stored in the hash table.
//
//
//
//
// User-friendly function function
//
// function AlphaToNormal takes unit whichUnit, real tick returns nothing
// The delivered unit becomes transparent momentarily and then gradually becomes clearer. (It becomes clearer at intervals equal to the tick.)
//
// function NormalToAlpha takes unit whichUnit, real tick returns nothing
// The delivered unit becomes instantly clear and then gradually becomes transparent. (It becomes transparent at intervals equal to the tick.)
//
// function DummyToAlpha takes unit whichUnit, real tick returns nothing
// Creates a pile of delivered units and gradually makes them transparent. (It becomes clearer at intervals equal to the tick.)
//
// function MessageToTarget takes unit target, string text, integer alpha, real size, real speed, real time, real low, real high, real decline, real cycle, integer red, integer green, integer blue, boolean same returns nothing
// Creates floating text of a specific size at the location of the received unit and reduces the size of the floating text by a certain amount at specific intervals.
//
//
//
//
// save function
//
// function HeroSave takes player p, string message returns nothing
// This is a save function.
//
//
//
//
// load function
//
// function HeroLoad takes player p, string message returns nothing
// This is the load function.
//
//*************************************************************************************************************************************************************************************
//************************************************************************************************************************************************************************
//*
//* internal system function
//*
//************************************************************************************************************************************************************************
function ToNotation takes integer input returns string
local string inputStr = I2S(input)
local string result = null
local integer mod
loop
exitwhen input <= 0
set mod = ModuloInteger(input, udg_keyLength)
set result = SubString(udg_keySet, mod, mod + 1) + result
set input = input / udg_keyLength
endloop
return result
endfunction
function ToInteger takes string input returns integer
local integer length = StringLength(input)
local string current = null
local integer result = 0
local integer loopA
local integer loopB
set loopA = 0
loop
exitwhen loopA >= length
set result = result * udg_keyLength
set current = SubString(input, loopA, loopA + 1)
set loopB = 0
loop
exitwhen (loopB >= udg_keyLength) or (current == SubString(udg_keySet, loopB, loopB + 1))
set loopB = loopB + 1
endloop
if (loopB <= udg_keyLength) then
set result = result + loopB
endif
set loopA = loopA + 1
endloop
return result
endfunction
function ToNotation2 takes integer input returns string
local string keySet = "01"
local integer keyLength = StringLength(keySet)
local string inputStr = I2S(input)
local string result = null
local integer mod
loop
exitwhen input <= 0
set mod = ModuloInteger(input, keyLength)
set result = SubString(keySet, mod, mod + 1) + result
set input = input / keyLength
endloop
return result
endfunction
function ToInteger2 takes string input returns integer
local string keySet = "01"
local integer keyLength = StringLength(keySet)
local integer length = StringLength(input)
local string current = null
local integer result = 0
local integer loopA
local integer loopB
set loopA = 0
loop
exitwhen loopA >= length
set result = result * keyLength
set current = SubString(input, loopA, loopA + 1)
set loopB = 0
loop
exitwhen (loopB >= keyLength) or (current == SubString(keySet, loopB, loopB + 1))
set loopB = loopB + 1
endloop
if (loopB <= keyLength) then
set result = result + loopB
endif
set loopA = loopA + 1
endloop
return result
endfunction
function CodeLength takes string input, integer notation returns string
local integer length = StringLength(input)
local integer blank = length - notation
if (blank < 0) then
loop
exitwhen blank >= 0
set input = udg_keyFirst + input
set blank = blank + 1
endloop
endif
return input
endfunction
function CodeLength2 takes string input, integer maxLength returns string
local integer length = StringLength(input)
local integer blank = length - maxLength
if (blank < 0) then
loop
exitwhen blank >= 0
set input = "0" + input
set blank = blank + 1
endloop
endif
return input
endfunction
function NameToInteger takes string name returns integer
local string alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890~`!#$^&*()-_=+|{}[]:;<>,.?@"
local string cutString
local integer alphabetLength = StringLength(alphabet)
local integer nameLength = StringLength(name)
local integer cutLength
local integer result = 0
local integer loopA
local integer loopB
set loopA = 0
loop
exitwhen loopA > nameLength
set cutString = SubString(name, loopA, loopA + 1)
set loopB = 0
loop
exitwhen loopB > alphabetLength
if (cutString == SubString(alphabet, loopB, loopB + 1)) then
set result = result + (loopB * loopA)
endif
set loopB = loopB + 1
endloop
set loopA = loopA + 1
endloop
return result
endfunction
function IsNumber takes string input returns boolean
local integer loopA
set loopA = 0
loop
exitwhen loopA > 9
if (input == I2S(loopA)) then
return true
endif
set loopA = loopA + 1
endloop
return false
endfunction
function IsSpecial takes string input returns boolean
local string alphabet = udg_specialChar
local integer loopA
set loopA = 0
loop
exitwhen loopA > StringLength(alphabet)
if (input == SubString(alphabet, loopA, loopA + 1)) then
return true
endif
set loopA = loopA + 1
endloop
return false
endfunction
function IsSmallAlphabet takes string input returns boolean
local string alphabet = udg_smallAlphabetChar
local integer loopA
set loopA = 0
loop
exitwhen loopA > StringLength(alphabet)
if (input == SubString(alphabet, loopA, loopA + 1)) then
return true
endif
set loopA = loopA + 1
endloop
return false
endfunction
function IsBigAlphabet takes string input returns boolean
local string alphabet = udg_bigAlphabetChar
local integer loopA
set loopA = 0
loop
exitwhen loopA > StringLength(alphabet)
if (input == SubString(alphabet, loopA, loopA + 1)) then
return true
endif
set loopA = loopA + 1
endloop
return false
endfunction
function CodeColor takes string input returns string
local string result = ""
local string small = "|cff8080FF"
local string big = "|cff75E975"
local string special = "|cffFF8000"
local string number = "|cffFEFE7F"
local string checkStr
local boolean prevSmall = false
local boolean prevBig = false
local boolean prevSpecial = false
local boolean prevNumber = false
local integer loopA
set loopA = 0
loop
exitwhen loopA > StringLength(input)
set checkStr = SubString(input, loopA, loopA + 1)
if (IsNumber(checkStr) == true) then
if (prevNumber == true) then
set result = result + checkStr
else
set result = result + number + checkStr
endif
set prevNumber = true
set prevSpecial = false
set prevSmall = false
set prevBig = false
endif
if (IsSpecial(checkStr) == true) then
if (prevSpecial == true) then
set result = result + checkStr
else
set result = result + special + checkStr
endif
set prevNumber = false
set prevSpecial = true
set prevSmall = false
set prevBig = false
endif
if (IsSmallAlphabet(checkStr) == true) then
if (prevSmall == true) then
set result = result + checkStr
else
set result = result + small + checkStr
endif
set prevNumber = false
set prevSpecial = false
set prevSmall = true
set prevBig = false
endif
if (IsBigAlphabet(checkStr) == true) then
if (prevBig == true) then
set result = result + checkStr
else
set result = result + big + checkStr
endif
set prevNumber = false
set prevSpecial = false
set prevSmall = false
set prevBig = true
endif
set loopA = loopA + 1
endloop
set result = result + "|r"
return result
endfunction
function HashSetting takes nothing returns nothing
local integer loopA
set udg_saveHeroHash = InitHashtable()
set udg_saveItemHash = InitHashtable()
set loopA = 1
loop
exitwhen loopA > 8192
if (udg_saveHero[loopA] != 0) then
call SaveInteger(udg_saveHeroHash, 0, udg_saveHero[loopA], loopA)
endif
if (udg_saveItem[loopA] != 0) then
call SaveInteger(udg_saveItemHash, 0, udg_saveItem[loopA], loopA)
endif
if (ModuloInteger(loopA, 700) == 0) then
call TriggerSleepAction(0.01)
endif
set loopA = loopA + 1
endloop
call SaveInteger(udg_saveHeroHash, 0, 0, 0)
call SaveInteger(udg_saveItemHash, 0, 0, 0)
endfunction
function MakeFile takes player p, string message, string lv returns nothing
local string gold = LoadStr(udg_dataTextStringHash, GetHandleId(p), udg_saveDataGold)
local string lumber = LoadStr(udg_dataTextStringHash, GetHandleId(p), udg_saveDataLumber)
local string char = LoadStr(udg_dataTextStringHash, GetHandleId(p), udg_saveDataHeroType)
local string heroExp = LoadStr(udg_dataTextStringHash, GetHandleId(p), udg_saveDataHeroExp)
local string heroStr = LoadStr(udg_dataTextStringHash, GetHandleId(p), udg_saveDataHeroStr)
local string heroAgi = LoadStr(udg_dataTextStringHash, GetHandleId(p), udg_saveDataHeroAgi)
local string heroInt = LoadStr(udg_dataTextStringHash, GetHandleId(p), udg_saveDataHeroInt)
local string heroItem1 = LoadStr(udg_dataTextStringHash, GetHandleId(p), udg_saveDataHeroItem1)
local string heroItem2 = LoadStr(udg_dataTextStringHash, GetHandleId(p), udg_saveDataHeroItem2)
local string heroItem3 = LoadStr(udg_dataTextStringHash, GetHandleId(p), udg_saveDataHeroItem3)
local string heroItem4 = LoadStr(udg_dataTextStringHash, GetHandleId(p), udg_saveDataHeroItem4)
local string heroItem5 = LoadStr(udg_dataTextStringHash, GetHandleId(p), udg_saveDataHeroItem5)
local string heroItem6 = LoadStr(udg_dataTextStringHash, GetHandleId(p), udg_saveDataHeroItem6)
local string heroCharge1 = LoadStr(udg_dataTextStringHash, GetHandleId(p), udg_saveDataHeroCharge1)
local string heroCharge2 = LoadStr(udg_dataTextStringHash, GetHandleId(p), udg_saveDataHeroCharge2)
local string heroCharge3 = LoadStr(udg_dataTextStringHash, GetHandleId(p), udg_saveDataHeroCharge3)
local string heroCharge4 = LoadStr(udg_dataTextStringHash, GetHandleId(p), udg_saveDataHeroCharge4)
local string heroCharge5 = LoadStr(udg_dataTextStringHash, GetHandleId(p), udg_saveDataHeroCharge5)
local string heroCharge6 = LoadStr(udg_dataTextStringHash, GetHandleId(p), udg_saveDataHeroCharge6)
local string bagItem1 = LoadStr(udg_dataTextStringHash, GetHandleId(p), udg_saveDataBagItem1)
local string bagItem2 = LoadStr(udg_dataTextStringHash, GetHandleId(p), udg_saveDataBagItem2)
local string bagItem3 = LoadStr(udg_dataTextStringHash, GetHandleId(p), udg_saveDataBagItem3)
local string bagItem4 = LoadStr(udg_dataTextStringHash, GetHandleId(p), udg_saveDataBagItem4)
local string bagItem5 = LoadStr(udg_dataTextStringHash, GetHandleId(p), udg_saveDataBagItem5)
local string bagItem6 = LoadStr(udg_dataTextStringHash, GetHandleId(p), udg_saveDataBagItem6)
local string bagCharge1 = LoadStr(udg_dataTextStringHash, GetHandleId(p), udg_saveDataBagCharge1)
local string bagCharge2 = LoadStr(udg_dataTextStringHash, GetHandleId(p), udg_saveDataBagCharge2)
local string bagCharge3 = LoadStr(udg_dataTextStringHash, GetHandleId(p), udg_saveDataBagCharge3)
local string bagCharge4 = LoadStr(udg_dataTextStringHash, GetHandleId(p), udg_saveDataBagCharge4)
local string bagCharge5 = LoadStr(udg_dataTextStringHash, GetHandleId(p), udg_saveDataBagCharge5)
local string bagCharge6 = LoadStr(udg_dataTextStringHash, GetHandleId(p), udg_saveDataBagCharge6)
local string saveTick = LoadStr(udg_dataTextStringHash, GetHandleId(p), udg_saveDataSaveTick)
local string code1 = LoadStr(udg_makeFileHash, GetHandleId(p), 1)
local string code2 = LoadStr(udg_makeFileHash, GetHandleId(p), 2)
local string code3 = LoadStr(udg_makeFileHash, GetHandleId(p), 3)
local string code4 = LoadStr(udg_makeFileHash, GetHandleId(p), 4)
local string code5 = LoadStr(udg_makeFileHash, GetHandleId(p), 5)
local string code6 = LoadStr(udg_makeFileHash, GetHandleId(p), 6)
local string code7 = LoadStr(udg_makeFileHash, GetHandleId(p), 7)
local string code8 = LoadStr(udg_makeFileHash, GetHandleId(p), 8)
local string code9 = LoadStr(udg_makeFileHash, GetHandleId(p), 9)
local string code10 = LoadStr(udg_makeFileHash, GetHandleId(p), 10)
local string code11 = LoadStr(udg_makeFileHash, GetHandleId(p), 11)
local string code12 = LoadStr(udg_makeFileHash, GetHandleId(p), 12)
local string code13 = LoadStr(udg_makeFileHash, GetHandleId(p), 13)
local string code14 = LoadStr(udg_makeFileHash, GetHandleId(p), 14)
local string code15 = LoadStr(udg_makeFileHash, GetHandleId(p), 15)
local string code16 = LoadStr(udg_makeFileHash, GetHandleId(p), 16)
local string code17 = LoadStr(udg_makeFileHash, GetHandleId(p), 17)
local string code18 = LoadStr(udg_makeFileHash, GetHandleId(p), 18)
local string code19 = LoadStr(udg_makeFileHash, GetHandleId(p), 19)
local string code20 = LoadStr(udg_makeFileHash, GetHandleId(p), 20)
local string code21 = LoadStr(udg_makeFileHash, GetHandleId(p), 21)
local string code22 = LoadStr(udg_makeFileHash, GetHandleId(p), 22)
local string code23 = LoadStr(udg_makeFileHash, GetHandleId(p), 23)
local string code24 = LoadStr(udg_makeFileHash, GetHandleId(p), 24)
local string code25 = LoadStr(udg_makeFileHash, GetHandleId(p), 25)
local string code26 = LoadStr(udg_makeFileHash, GetHandleId(p), 26)
local string code27 = LoadStr(udg_makeFileHash, GetHandleId(p), 27)
local string code28 = LoadStr(udg_makeFileHash, GetHandleId(p), 28)
local string code29 = LoadStr(udg_makeFileHash, GetHandleId(p), 29)
local string code30 = LoadStr(udg_makeFileHash, GetHandleId(p), 30)
local string fileName = GetPlayerName(p) + "_" + saveTick + "_" + I2S(GetRandomInt(1000000000, 2000000000))
// caution! Please do not delete information about my sources or delete Grabiti's RPG Creator from the folder path. please.
if (GetLocalPlayer() == p) then
call PreloadGenClear()
call PreloadGenStart()
call Preload("----------------- Save Code ------------------")
if (code1 != null) then
call Preload("Code1: " + code1 + " ")
endif
if (code2 != null) then
call Preload("Code2: " + code2 + " ")
endif
if (code3 != null) then
call Preload("Code3: " + code3 + " ")
endif
if (code4 != null) then
call Preload("Code4: " + code4 + " ")
endif
if (code5 != null) then
call Preload("Code5: " + code5 + " ")
endif
if (code6 != null) then
call Preload("Code6: " + code6 + " ")
endif
if (code7 != null) then
call Preload("Code7: " + code7 + " ")
endif
if (code8 != null) then
call Preload("Code8: " + code8 + " ")
endif
if (code9 != null) then
call Preload("Code9: " + code9 + " ")
endif
if (code10 != null) then
call Preload("Code10: " + code10 + " ")
endif
if (code11 != null) then
call Preload("Code11: " + code11 + " ")
endif
if (code12 != null) then
call Preload("Code12: " + code12 + " ")
endif
if (code13 != null) then
call Preload("Code13: " + code13 + " ")
endif
if (code14 != null) then
call Preload("Code14: " + code14 + " ")
endif
if (code15 != null) then
call Preload("Code15: " + code15 + " ")
endif
if (code16 != null) then
call Preload("Code16: " + code16 + " ")
endif
if (code17 != null) then
call Preload("Code17: " + code17 + " ")
endif
if (code18 != null) then
call Preload("Code18: " + code18 + " ")
endif
if (code19 != null) then
call Preload("Code19: " + code19 + " ")
endif
if (code20 != null) then
call Preload("Code20: " + code20 + " ")
endif
if (code21 != null) then
call Preload("Code21: " + code21 + " ")
endif
if (code22 != null) then
call Preload("Code22: " + code22 + " ")
endif
if (code23 != null) then
call Preload("Code23: " + code23 + " ")
endif
if (code24 != null) then
call Preload("Code24: " + code24 + " ")
endif
if (code25 != null) then
call Preload("Code25: " + code25 + " ")
endif
if (code26 != null) then
call Preload("Code26: " + code26 + " ")
endif
if (code27 != null) then
call Preload("Code27: " + code27 + " ")
endif
if (code28 != null) then
call Preload("Code28: " + code28 + " ")
endif
if (code29 != null) then
call Preload("Code29: " + code29 + " ")
endif
if (code30 != null) then
call Preload("Code30: " + code30 + " ")
endif
call Preload("----------------- Data Stats -----------------")
if (gold != "0") then
call Preload("Gold: " + gold)
endif
if (lumber != "0") then
call Preload("Lumber: " + lumber)
endif
if (char != "0") then
call Preload("Char: " + char)
endif
if (lv != "0") then
call Preload("Lv: " + lv)
endif
if (heroExp != "0") then
call Preload("Exp: " + heroExp)
endif
if (heroStr != "0") then
call Preload("Str: " + heroStr)
endif
if (heroAgi != "0") then
call Preload("Agi: " + heroAgi)
endif
if (heroInt != "0") then
call Preload("Int: " + heroInt)
endif
if (heroItem1 != "0") then
call Preload("HeroItem1: '" + heroItem1 + "' Charges: " + heroCharge1)
endif
if (heroItem2 != "0") then
call Preload("HeroItem2: '" + heroItem2 + "' Charges: " + heroCharge2)
endif
if (heroItem3 != "0") then
call Preload("HeroItem3: '" + heroItem3 + "' Charges: " + heroCharge3)
endif
if (heroItem4 != "0") then
call Preload("HeroItem4: '" + heroItem4 + "' Charges: " + heroCharge4)
endif
if (heroItem5 != "0") then
call Preload("HeroItem5: '" + heroItem5 + "' Charges: " + heroCharge5)
endif
if (heroItem6 != "0") then
call Preload("HeroItem6: '" + heroItem6 + "' Charges: " + heroCharge6)
endif
if (bagItem1 != "0") then
call Preload("BagItem1: '" + bagItem1 + "' Charges: " + bagCharge1)
endif
if (bagItem2 != "0") then
call Preload("BagItem2: '" + bagItem2 + "' Charges: " + bagCharge2)
endif
if (bagItem3 != "0") then
call Preload("BagItem3: '" + bagItem3 + "' Charges: " + bagCharge3)
endif
if (bagItem4 != "0") then
call Preload("BagItem4: '" + bagItem4 + "' Charges: " + bagCharge4)
endif
if (bagItem5 != "0") then
call Preload("BagItem5: '" + bagItem5 + "' Charges: " + bagCharge5)
endif
if (bagItem6 != "0") then
call Preload("BagItem6: '" + bagItem6 + "' Charges: " + bagCharge6)
endif
call Preload("---------------- Chat Message ----------------")
call Preload(message)
call Preload("Grabiti's RPG Creator: http://cafe.naver.com/rpgcreator")
call Preload("Translated By Enemy1PK")
call Preload("YDWE PK Edition - Best Map Editor: https://www.hiveworkshop.com/threads/ydwe-pk-edition.351329")
call PreloadGenEnd("Grabiti's RPG Creator" + "\\" + udg_MapName + "\\" + fileName + ".txt")
call PreloadEnd(3.0)
call DisplayTimedTextToPlayer(p, 0.0, 0.0, 10.0, "|cfffffc01warcraft folder\\Grabiti's RPG Creator\\" + udg_MapName + " in the folder " + fileName + "Saved as .txt.|r\n|c00DFFB4FThis map was created based on Grabiti's RPG Creator 1.08. translated by Enemy1PK|r")
call FlushChildHashtable(udg_dataTextStringHash, GetHandleId(p))
call FlushChildHashtable(udg_makeFileHash, GetHandleId(p))
endif
endfunction
function PrintCodeTimer takes nothing returns nothing
local timer t = GetExpiredTimer()
local player p = LoadPlayerHandle(udg_printCodeHash, GetHandleId(t), 0)
local string saveResult = LoadStr(udg_printCodeHash, GetHandleId(t), 0)
local integer codeLine = LoadInteger(udg_printCodeHash, GetHandleId(t), 0)
if (saveResult != null) then
call DisplayTimedTextToPlayer(p, 0.0, 0.0, 999.0, "|c00DFFB4FCode" + I2S(codeLine) + "\n" + CodeColor(saveResult))
endif
call FlushChildHashtable(udg_printCodeHash, GetHandleId(t))
call DestroyTimer(t)
set t = null
set p = null
endfunction
function PrintCode takes player p, string saveResult, integer codeLine returns nothing
local timer t = CreateTimer()
call SavePlayerHandle(udg_printCodeHash, GetHandleId(t), 0, p)
call SaveStr(udg_printCodeHash, GetHandleId(t), 0, saveResult)
call SaveInteger(udg_printCodeHash, GetHandleId(t), 0, codeLine)
call TimerStart(t, 0.0, false, function PrintCodeTimer)
set t = null
endfunction
function DataOnBoolean takes integer loopA returns boolean
if (loopA == udg_saveDataLengthCheck) or (loopA == udg_saveDataLength1) or (loopA == udg_saveDataLength2) or (loopA == udg_saveDataLength3) or (loopA == udg_saveDataLength4) or (loopA == udg_saveDataLength5) or (loopA == udg_saveDataLength6) or (loopA == udg_saveDataLength7) or (loopA == udg_saveDataLength8) or (loopA == udg_saveDataLength9) or (loopA == udg_saveDataLength10) or (loopA == udg_saveDataLength11) or (loopA == udg_saveDataLength12) or (loopA == udg_saveDataLength13) or (loopA == udg_saveDataLength14) or (loopA == udg_saveDataLength15) or (loopA == udg_saveDataLength16) or (loopA == udg_saveDataLength17) or (loopA == udg_saveDataLength18) or (loopA == udg_saveDataLength19) or (loopA == udg_saveDataLength20) or (loopA == udg_saveDataLength21) or (loopA == udg_saveDataLength22) or (loopA == udg_saveDataLength23) or (loopA == udg_saveDataLength24) or (loopA == udg_saveDataEncryption) then
return true
else
return false
endif
endfunction
function SaveDataHash takes player p returns nothing
local integer loopA
set loopA = 1
loop
exitwhen loopA > udg_saveDataN
call SaveInteger(udg_dataHash, GetConvertedPlayerId(p), loopA, udg_data[loopA])
set loopA = loopA + 1
endloop
endfunction
//************************************************************************************************************************************************************************
//*
//* User-friendly function function
//*
//************************************************************************************************************************************************************************
function AlphaToNormalTimer takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit whichUnit = LoadUnitHandle(udg_alphaToNormalHash, GetHandleId(t), 0)
local integer timerLoop = LoadInteger(udg_alphaToNormalHash, GetHandleId(t), 1)
if (timerLoop > 0) then
set timerLoop = timerLoop - 1
call SetUnitVertexColorBJ(whichUnit, 100, 100, 100, I2R(timerLoop * 10))
call SaveInteger(udg_alphaToNormalHash, GetHandleId(t), 1, timerLoop)
else
call FlushChildHashtable(udg_alphaToNormalHash, GetHandleId(t))
call DestroyTimer(t)
endif
set t = null
set whichUnit = null
endfunction
function AlphaToNormal takes unit whichUnit, real tick returns nothing
local timer t = CreateTimer()
local integer timerLoop = 10
call SetUnitVertexColorBJ(whichUnit, 100, 100, 100, 100.0)
call SaveUnitHandle(udg_alphaToNormalHash, GetHandleId(t), 0, whichUnit)
call SaveInteger(udg_alphaToNormalHash, GetHandleId(t), 1, timerLoop)
call TimerStart(t, tick, true, function AlphaToNormalTimer)
set t = null
endfunction
function NormalToAlphaTimer takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit whichUnit = LoadUnitHandle(udg_normalToAlphaHash, GetHandleId(t), 0)
local integer timerLoop = LoadInteger(udg_normalToAlphaHash, GetHandleId(t), 1)
if (timerLoop > 0) then
set timerLoop = timerLoop - 1
call SetUnitVertexColorBJ(whichUnit, 100, 100, 100, 100.0 - I2R(timerLoop * 10))
call SaveInteger(udg_normalToAlphaHash, GetHandleId(t), 1, timerLoop)
else
call FlushChildHashtable(udg_normalToAlphaHash, GetHandleId(t))
call DestroyTimer(t)
endif
set t = null
set whichUnit = null
endfunction
function NormalToAlpha takes unit whichUnit, real tick returns nothing
local timer t = CreateTimer()
local integer timerLoop = 10
call SetUnitVertexColorBJ(whichUnit, 100, 100, 100, 0.0)
call SaveUnitHandle(udg_normalToAlphaHash, GetHandleId(t), 0, whichUnit)
call SaveInteger(udg_normalToAlphaHash, GetHandleId(t), 1, timerLoop)
call TimerStart(t, tick, true, function NormalToAlphaTimer)
set t = null
endfunction
function DummyToAlphaTimer takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit tempUnit = LoadUnitHandle(udg_dummyToAlphaHash, GetHandleId(t), 0)
local integer timerLoop = LoadInteger(udg_dummyToAlphaHash, GetHandleId(t), 1)
if (timerLoop > 0) then
set timerLoop = timerLoop - 1
call SetUnitVertexColorBJ(tempUnit, 100, 100, 100, 100.0 - I2R(timerLoop * 10))
call SaveInteger(udg_dummyToAlphaHash, GetHandleId(t), 1, timerLoop)
else
call RemoveUnit(tempUnit)
call FlushChildHashtable(udg_dummyToAlphaHash, GetHandleId(t))
call DestroyTimer(t)
endif
set t = null
set tempUnit = null
endfunction
function DummyToAlpha takes unit whichUnit, real tick returns nothing
local timer t = CreateTimer()
local unit tempUnit
local integer timerLoop = 10
set tempUnit = CreateUnit(GetOwningPlayer(whichUnit), GetUnitTypeId(whichUnit), GetUnitX(whichUnit), GetUnitY(whichUnit), GetUnitFacing(GetTriggerUnit()))
call UnitAddAbility(tempUnit, 'Aloc')
call UnitMakeAbilityPermanent(tempUnit, true, 'Aloc')
call SaveUnitHandle(udg_dummyToAlphaHash, GetHandleId(t), 0, tempUnit)
call SaveInteger(udg_dummyToAlphaHash, GetHandleId(t), 1, timerLoop)
call TimerStart(t, tick, true, function DummyToAlphaTimer)
set t = null
set tempUnit = null
endfunction
function MessageToTargetNonOverlap takes nothing returns nothing
local timer sameTimer = GetExpiredTimer()
local integer targetId = LoadInteger(udg_messageToTargetHash, GetHandleId(sameTimer), 0)
call FlushChildHashtable(udg_messageToTargetHash, targetId)
call FlushChildHashtable(udg_messageToTargetHash, GetHandleId(sameTimer))
call DestroyTimer(sameTimer)
set sameTimer = null
endfunction
function MessageToTargetTimer takes nothing returns nothing
local timer t = GetExpiredTimer()
local texttag textTag = LoadTextTagHandle(udg_messageToTargetHash, GetHandleId(t), 0)
local string text = LoadStr(udg_messageToTargetHash, GetHandleId(t), 1)
local real size = LoadReal(udg_messageToTargetHash, GetHandleId(t), 2)
local real decline = LoadReal(udg_messageToTargetHash, GetHandleId(t), 3)
local real cycle = LoadReal(udg_messageToTargetHash, GetHandleId(t), 4)
local integer loopN = LoadInteger(udg_messageToTargetHash, GetHandleId(t), 5)
if (loopN > 0) then
set loopN = loopN - 1
set decline = decline / 100
set size = size / (1 + decline)
set decline = decline * 100
call SetTextTagText(textTag, text, size * 0.023 / 10)
call SaveTextTagHandle(udg_messageToTargetHash, GetHandleId(t), 0, textTag)
call SaveStr(udg_messageToTargetHash, GetHandleId(t), 1, text)
call SaveReal(udg_messageToTargetHash, GetHandleId(t), 2, size)
call SaveReal(udg_messageToTargetHash, GetHandleId(t), 3, decline)
call SaveReal(udg_messageToTargetHash, GetHandleId(t), 4, cycle)
call SaveInteger(udg_messageToTargetHash, GetHandleId(t), 5, loopN)
else
call FlushChildHashtable(udg_messageToTargetHash, GetHandleId(t))
call DestroyTimer(t)
endif
set t = null
set textTag = null
endfunction
function MessageToTarget takes unit target, string text, integer alpha, real size, real speed, real time, real low, real high, integer decline, real cycle, integer red, integer green, integer blue, boolean same returns nothing
local timer t
local timer sameTimer
local texttag textTag
local real vel = speed * 0.071 / 128
local real xvel = vel * Cos(GetRandomReal(low, high) * bj_DEGTORAD)
local real yvel = vel * Sin(GetRandomReal(low, high) * bj_DEGTORAD)
local integer loopN = 5
if (same == true) then
if (HaveSavedHandle(udg_messageToTargetHash, GetHandleId(target), 0)) then
set sameTimer = LoadTimerHandle(udg_messageToTargetHash, GetHandleId(target), 0)
if (TimerGetRemaining(sameTimer) != 0.0) then
set t = null
set sameTimer = null
set textTag = null
return
endif
endif
set sameTimer = CreateTimer()
call SaveTimerHandle(udg_messageToTargetHash, GetHandleId(target), 0, sameTimer)
call SaveInteger(udg_messageToTargetHash, GetHandleId(sameTimer), 0, GetHandleId(target))
call TimerStart(sameTimer, 0.001, false, function MessageToTargetNonOverlap)
endif
set textTag = CreateTextTag()
call SetTextTagText(textTag, text, size * 0.023 / 10)
call SetTextTagPosUnit(textTag, target, 0.00)
call SetTextTagColor(textTag, red, green, blue, alpha)
call SetTextTagPermanent(textTag, false)
call SetTextTagLifespan(textTag, time)
call SetTextTagFadepoint(textTag, 0.00)
call SetTextTagVelocity(textTag, xvel, yvel)
set t = CreateTimer()
call SaveTextTagHandle(udg_messageToTargetHash, GetHandleId(t), 0, textTag)
call SaveStr(udg_messageToTargetHash, GetHandleId(t), 1, text)
call SaveReal(udg_messageToTargetHash, GetHandleId(t), 2, size)
call SaveReal(udg_messageToTargetHash, GetHandleId(t), 3, decline)
call SaveReal(udg_messageToTargetHash, GetHandleId(t), 4, cycle)
call SaveInteger(udg_messageToTargetHash, GetHandleId(t), 5, loopN)
call TimerStart(t, cycle, true, function MessageToTargetTimer)
set t = null
set sameTimer = null
set textTag = null
endfunction
//************************************************************************************************************************************************************************
//*
//* save function
//*
//************************************************************************************************************************************************************************
function HeroSave takes player p, string message returns nothing
local string array data
local integer array dataOn
local string result = null
local string array saveResult
local string array dataTextString
local integer checkNum = 0
local unit hero = udg_hero[GetConvertedPlayerId(p)]
local unit bag = udg_bag[GetConvertedPlayerId(p)]
local integer num
local integer num2
local real real1
local integer loopA
local integer loopExit
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// Data settings (Save)
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
set loopA = 1
loop
exitwhen loopA > udg_saveDataN
if (DataOnBoolean(loopA) == false) then
set num = 0
// Compare whether the data exceeds the maximum and, if so, set it to the maximum.
if (LoadInteger(udg_dataHash, GetConvertedPlayerId(p), loopA) < R2I(Pow(udg_keyLength, udg_saveData[loopA]))) then
set num = LoadInteger(udg_dataHash, GetConvertedPlayerId(p), loopA)
else
set num = R2I(Pow(udg_keyLength, udg_saveData[loopA]) - 1)
endif
// Set the data.
set data[loopA] = ToNotation(num)
set dataTextString[loopA] = I2S(num)
endif
set loopA = loopA + 1
endloop
// Set the names of units and items.
set dataTextString[udg_saveDataHeroType] = GetUnitName(hero)
set dataTextString[udg_saveDataHeroItem1] = GetItemName(UnitItemInSlot(hero, 0))
set dataTextString[udg_saveDataHeroItem2] = GetItemName(UnitItemInSlot(hero, 1))
set dataTextString[udg_saveDataHeroItem3] = GetItemName(UnitItemInSlot(hero, 2))
set dataTextString[udg_saveDataHeroItem4] = GetItemName(UnitItemInSlot(hero, 3))
set dataTextString[udg_saveDataHeroItem5] = GetItemName(UnitItemInSlot(hero, 4))
set dataTextString[udg_saveDataHeroItem6] = GetItemName(UnitItemInSlot(hero, 5))
set dataTextString[udg_saveDataBagItem1] = GetItemName(UnitItemInSlot(bag, 0))
set dataTextString[udg_saveDataBagItem2] = GetItemName(UnitItemInSlot(bag, 1))
set dataTextString[udg_saveDataBagItem3] = GetItemName(UnitItemInSlot(bag, 2))
set dataTextString[udg_saveDataBagItem4] = GetItemName(UnitItemInSlot(bag, 3))
set dataTextString[udg_saveDataBagItem5] = GetItemName(UnitItemInSlot(bag, 4))
set dataTextString[udg_saveDataBagItem6] = GetItemName(UnitItemInSlot(bag, 5))
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// Check whether the data is the correct value. (Save)
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// If the save target does not exist, saving stops.
if (hero == null) then
call DisplayTimedTextToPlayer(p, 0.0, 0.0, 10.0, "|cffFF0202Error) |c00DFFB4FThe save target does not exist.|r")
set hero = null
set bag = null
set udg_codeSavingNow[GetConvertedPlayerId(p)] = false
return
endif
// If the hero to be saved does not exist in the array set in the setup HeroItem trigger, the save is stopped.
if (LoadInteger(udg_saveHeroHash, 0, GetUnitTypeId(hero)) == 0) then
call DisplayTimedTextToPlayer(p, 0.0, 0.0, 10.0, "|cffFF0202Error) |c00DFFB4FThe save target is not a hero set in the array.|r")
set hero = null
set bag = null
set udg_codeSavingNow[GetConvertedPlayerId(p)] = false
return
endif
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// Set whether the value of each data is 0 or greater than 1. (Save)
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
set loopA = 1
loop
exitwhen loopA > udg_saveDataN
if (ToInteger(data[loopA]) > 0) or (DataOnBoolean(loopA)) then
set dataOn[loopA] = 1
else
set dataOn[loopA] = 0
endif
if (ModuloInteger(loopA, 100) == 0) then
call TriggerSleepAction(0.01)
endif
set loopA = loopA + 1
endloop
// Due to the nature of Warcraft, the function is forcibly terminated when the loop runs a certain amount, so wait for a while.
call TriggerSleepAction(0.01)
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// Code length value 1 (Save) Among the data, information with a numeric value of 0 is excluded from the code.
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
set data[udg_saveDataLength1] = null
// The values ??compared to whether dataOn of each data is 0 or 1 are grouped into one string.
set loopA = 1
set loopExit = 1
loop
exitwhen (loopA > udg_saveDataN) or (loopExit > 30)
set data[udg_saveDataLength1] = I2S(dataOn[loopA]) + data[udg_saveDataLength1]
set loopExit = loopExit + 1
set loopA = loopA + 1
endloop
// Set the code length value to 1
if (ToInteger2(data[udg_saveDataLength1]) != 0) then
set data[udg_saveDataLength1] = ToNotation(ToInteger2(data[udg_saveDataLength1]))
else
set dataOn[udg_saveDataLength1] = 0
endif
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// Code length value 2 (Save) Among the data, information with a numeric value of 0 is excluded from the code.
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
set data[udg_saveDataLength2] = null
// The values ??compared to whether dataOn of each data is 0 or 1 are grouped into one string.
set loopA = 31
set loopExit = 1
loop
exitwhen (loopA > udg_saveDataN) or (loopExit > 30)
set data[udg_saveDataLength2] = I2S(dataOn[loopA]) + data[udg_saveDataLength2]
set loopExit = loopExit + 1
set loopA = loopA + 1
endloop
// Set the code length value to 2
if (ToInteger2(data[udg_saveDataLength2]) != 0) then
set data[udg_saveDataLength2] = ToNotation(ToInteger2(data[udg_saveDataLength2]))
else
set dataOn[udg_saveDataLength2] = 0
endif
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// Code length value 3 (Save) Among the data, information with a numeric value of 0 is excluded from the code.
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
set data[udg_saveDataLength3] = null
// The values ??compared to whether dataOn of each data is 0 or 1 are grouped into one string.
set loopA = 61
set loopExit = 1
loop
exitwhen (loopA > udg_saveDataN) or (loopExit > 30)
set data[udg_saveDataLength3] = I2S(dataOn[loopA]) + data[udg_saveDataLength3]
set loopExit = loopExit + 1
set loopA = loopA + 1
endloop
// Set the code length value to 3
if (ToInteger2(data[udg_saveDataLength3]) != 0) then
set data[udg_saveDataLength3] = ToNotation(ToInteger2(data[udg_saveDataLength3]))
else
set dataOn[udg_saveDataLength3] = 0
endif
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// Code length value 4 (Save) Among the data, information with a numeric value of 0 is excluded from the code.
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
set data[udg_saveDataLength4] = null
// The values ??compared to whether dataOn of each data is 0 or 1 are grouped into one string.
set loopA = 91
set loopExit = 1
loop
exitwhen (loopA > udg_saveDataN) or (loopExit > 30)
set data[udg_saveDataLength4] = I2S(dataOn[loopA]) + data[udg_saveDataLength4]
set loopExit = loopExit + 1
set loopA = loopA + 1
endloop
// Set the code length value to 4
if (ToInteger2(data[udg_saveDataLength4]) != 0) then
set data[udg_saveDataLength4] = ToNotation(ToInteger2(data[udg_saveDataLength4]))
else
set dataOn[udg_saveDataLength4] = 0
endif
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// Code length value 5 (Save) Among the data, information with a numeric value of 0 is excluded from the code.
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
set data[udg_saveDataLength5] = null
// The values ??compared to whether dataOn of each data is 0 or 1 are grouped into one string.
set loopA = 121
set loopExit = 1
loop
exitwhen (loopA > udg_saveDataN) or (loopExit > 30)
set data[udg_saveDataLength5] = I2S(dataOn[loopA]) + data[udg_saveDataLength5]
set loopExit = loopExit + 1
set loopA = loopA + 1
endloop
// Set the code length value to 5
if (ToInteger2(data[udg_saveDataLength5]) != 0) then
set data[udg_saveDataLength5] = ToNotation(ToInteger2(data[udg_saveDataLength5]))
else
set dataOn[udg_saveDataLength5] = 0
endif
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// Code length value 6 (Save) Among the data, information with a numeric value of 0 is excluded from the code.
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
set data[udg_saveDataLength6] = null
// The values ??compared to whether dataOn of each data is 0 or 1 are grouped into one string.
set loopA = 151
set loopExit = 1
loop
exitwhen (loopA > udg_saveDataN) or (loopExit > 30)
set data[udg_saveDataLength6] = I2S(dataOn[loopA]) + data[udg_saveDataLength6]
set loopExit = loopExit + 1
set loopA = loopA + 1
endloop
// Set the code length value to 6
if (ToInteger2(data[udg_saveDataLength6]) != 0) then
set data[udg_saveDataLength6] = ToNotation(ToInteger2(data[udg_saveDataLength6]))
else
set dataOn[udg_saveDataLength6] = 0
endif
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// Code length value 7 (Save) Among the data, information with a numeric value of 0 is excluded from the code.
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
set data[udg_saveDataLength7] = null
// The values ??compared to whether dataOn of each data is 0 or 1 are grouped into one string.
set loopA = 181
set loopExit = 1
loop
exitwhen (loopA > udg_saveDataN) or (loopExit > 30)
set data[udg_saveDataLength7] = I2S(dataOn[loopA]) + data[udg_saveDataLength7]
set loopExit = loopExit + 1
set loopA = loopA + 1
endloop
// Set the code length value to 7
if (ToInteger2(data[udg_saveDataLength7]) != 0) then
set data[udg_saveDataLength7] = ToNotation(ToInteger2(data[udg_saveDataLength7]))
else
set dataOn[udg_saveDataLength7] = 0
endif
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// Code length value 8 (Save) Among the data, information with a numeric value of 0 is excluded from the code.
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
set data[udg_saveDataLength8] = null
// The values ??compared to whether dataOn of each data is 0 or 1 are grouped into one string.
set loopA = 211
set loopExit = 1
loop
exitwhen (loopA > udg_saveDataN) or (loopExit > 30)
set data[udg_saveDataLength8] = I2S(dataOn[loopA]) + data[udg_saveDataLength8]
set loopExit = loopExit + 1
set loopA = loopA + 1
endloop
// Set the code length value to 8
if (ToInteger2(data[udg_saveDataLength8]) != 0) then
set data[udg_saveDataLength8] = ToNotation(ToInteger2(data[udg_saveDataLength8]))
else
set dataOn[udg_saveDataLength8] = 0
endif
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// Code length value 9 (Save) Among the data, information with a numeric value of 0 is excluded from the code.
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
set data[udg_saveDataLength9] = null
// The values ??compared to whether dataOn of each data is 0 or 1 are grouped into one string.
set loopA = 241
set loopExit = 1
loop
exitwhen (loopA > udg_saveDataN) or (loopExit > 30)
set data[udg_saveDataLength9] = I2S(dataOn[loopA]) + data[udg_saveDataLength9]
set loopExit = loopExit + 1
set loopA = loopA + 1
endloop
// Set the code length value to 9
if (ToInteger2(data[udg_saveDataLength9]) != 0) then
set data[udg_saveDataLength9] = ToNotation(ToInteger2(data[udg_saveDataLength9]))
else
set dataOn[udg_saveDataLength9] = 0
endif
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// Code length value 10 (Save) Among the data, information with a numeric value of 0 is excluded from the code.
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
set data[udg_saveDataLength10] = null
// The values ??compared to whether dataOn of each data is 0 or 1 are grouped into one string.
set loopA = 271
set loopExit = 1
loop
exitwhen (loopA > udg_saveDataN) or (loopExit > 30)
set data[udg_saveDataLength10] = I2S(dataOn[loopA]) + data[udg_saveDataLength10]
set loopExit = loopExit + 1
set loopA = loopA + 1
endloop
// Set the code length value to 10
if (ToInteger2(data[udg_saveDataLength10]) != 0) then
set data[udg_saveDataLength10] = ToNotation(ToInteger2(data[udg_saveDataLength10]))
else
set dataOn[udg_saveDataLength10] = 0
endif
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// Code length value 11 (Save) Among the data, information with a numeric value of 0 is excluded from the code.
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
set data[udg_saveDataLength11] = null
// The values ??compared to whether dataOn of each data is 0 or 1 are grouped into one string.
set loopA = 301
set loopExit = 1
loop
exitwhen (loopA > udg_saveDataN) or (loopExit > 30)
set data[udg_saveDataLength11] = I2S(dataOn[loopA]) + data[udg_saveDataLength11]
set loopExit = loopExit + 1
set loopA = loopA + 1
endloop
// Set the code length value to 11
if (ToInteger2(data[udg_saveDataLength11]) != 0) then
set data[udg_saveDataLength11] = ToNotation(ToInteger2(data[udg_saveDataLength11]))
else
set dataOn[udg_saveDataLength11] = 0
endif
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// Code length value 12 (Save) Among the data, information with a numeric value of 0 is excluded from the code.
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
set data[udg_saveDataLength12] = null
// The values ??compared to whether dataOn of each data is 0 or 1 are grouped into one string.
set loopA = 331
set loopExit = 1
loop
exitwhen (loopA > udg_saveDataN) or (loopExit > 30)
set data[udg_saveDataLength12] = I2S(dataOn[loopA]) + data[udg_saveDataLength12]
set loopExit = loopExit + 1
set loopA = loopA + 1
endloop
// Set the code length value to 12
if (ToInteger2(data[udg_saveDataLength12]) != 0) then
set data[udg_saveDataLength12] = ToNotation(ToInteger2(data[udg_saveDataLength12]))
else
set dataOn[udg_saveDataLength12] = 0
endif
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// Code length value 13 (Save) Among the data, information with a numeric value of 0 is excluded from the code.
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
set data[udg_saveDataLength13] = null
// The values ??compared to whether dataOn of each data is 0 or 1 are grouped into one string.
set loopA = 361
set loopExit = 1
loop
exitwhen (loopA > udg_saveDataN) or (loopExit > 30)
set data[udg_saveDataLength13] = I2S(dataOn[loopA]) + data[udg_saveDataLength13]
set loopExit = loopExit + 1
set loopA = loopA + 1
endloop
// Set the code length value to 13
if (ToInteger2(data[udg_saveDataLength13]) != 0) then
set data[udg_saveDataLength13] = ToNotation(ToInteger2(data[udg_saveDataLength13]))
else
set dataOn[udg_saveDataLength13] = 0
endif
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// Code length value 14 (Save) Among the data, information with a numeric value of 0 is excluded from the code.
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
set data[udg_saveDataLength14] = null
// The values ??compared to whether dataOn of each data is 0 or 1 are grouped into one string.
set loopA = 391
set loopExit = 1
loop
exitwhen (loopA > udg_saveDataN) or (loopExit > 30)
set data[udg_saveDataLength14] = I2S(dataOn[loopA]) + data[udg_saveDataLength14]
set loopExit = loopExit + 1
set loopA = loopA + 1
endloop
// Set the code length value to 14
if (ToInteger2(data[udg_saveDataLength14]) != 0) then
set data[udg_saveDataLength14] = ToNotation(ToInteger2(data[udg_saveDataLength14]))
else
set dataOn[udg_saveDataLength14] = 0
endif
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// Code length value 15 (Save) Among the data, information with a numeric value of 0 is excluded from the code.
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
set data[udg_saveDataLength15] = null
// The values ??compared to whether dataOn of each data is 0 or 1 are grouped into one string.
set loopA = 421
set loopExit = 1
loop
exitwhen (loopA > udg_saveDataN) or (loopExit > 30)
set data[udg_saveDataLength15] = I2S(dataOn[loopA]) + data[udg_saveDataLength15]
set loopExit = loopExit + 1
set loopA = loopA + 1
endloop
// Set the code length value to 15
if (ToInteger2(data[udg_saveDataLength15]) != 0) then
set data[udg_saveDataLength15] = ToNotation(ToInteger2(data[udg_saveDataLength15]))
else
set dataOn[udg_saveDataLength15] = 0
endif
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// Code length value 16 (Save) Among the data, information with a numeric value of 0 is excluded from the code.
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
set data[udg_saveDataLength16] = null
// The values ??compared to whether dataOn of each data is 0 or 1 are grouped into one string.
set loopA = 451
set loopExit = 1
loop
exitwhen (loopA > udg_saveDataN) or (loopExit > 30)
set data[udg_saveDataLength16] = I2S(dataOn[loopA]) + data[udg_saveDataLength16]
set loopExit = loopExit + 1
set loopA = loopA + 1
endloop
// Set the code length value to 16
if (ToInteger2(data[udg_saveDataLength16]) != 0) then
set data[udg_saveDataLength16] = ToNotation(ToInteger2(data[udg_saveDataLength16]))
else
set dataOn[udg_saveDataLength16] = 0
endif
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// Code length value 17 (Save) Among the data, information with a numeric value of 0 is excluded from the code.
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
set data[udg_saveDataLength17] = null
// The values ??compared to whether dataOn of each data is 0 or 1 are grouped into one string.
set loopA = 481
set loopExit = 1
loop
exitwhen (loopA > udg_saveDataN) or (loopExit > 30)
set data[udg_saveDataLength17] = I2S(dataOn[loopA]) + data[udg_saveDataLength17]
set loopExit = loopExit + 1
set loopA = loopA + 1
endloop
// Set the code length value to 17
if (ToInteger2(data[udg_saveDataLength17]) != 0) then
set data[udg_saveDataLength17] = ToNotation(ToInteger2(data[udg_saveDataLength17]))
else
set dataOn[udg_saveDataLength17] = 0
endif
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// Code length value 18 (Save) Among the data, information with a numeric value of 0 is excluded from the code.
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
set data[udg_saveDataLength18] = null
// The values ??compared to whether dataOn of each data is 0 or 1 are grouped into one string.
set loopA = 511
set loopExit = 1
loop
exitwhen (loopA > udg_saveDataN) or (loopExit > 30)
set data[udg_saveDataLength18] = I2S(dataOn[loopA]) + data[udg_saveDataLength18]
set loopExit = loopExit + 1
set loopA = loopA + 1
endloop
// Set the code length value to 18
if (ToInteger2(data[udg_saveDataLength18]) != 0) then
set data[udg_saveDataLength18] = ToNotation(ToInteger2(data[udg_saveDataLength18]))
else
set dataOn[udg_saveDataLength18] = 0
endif
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// Code length value 19 (Save) Among the data, information with a numeric value of 0 is excluded from the code.
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
set data[udg_saveDataLength19] = null
// The values ??compared to whether dataOn of each data is 0 or 1 are grouped into one string.
set loopA = 541
set loopExit = 1
loop
exitwhen (loopA > udg_saveDataN) or (loopExit > 30)
set data[udg_saveDataLength19] = I2S(dataOn[loopA]) + data[udg_saveDataLength19]
set loopExit = loopExit + 1
set loopA = loopA + 1
endloop
// Set the code length value to 19
if (ToInteger2(data[udg_saveDataLength19]) != 0) then
set data[udg_saveDataLength19] = ToNotation(ToInteger2(data[udg_saveDataLength19]))
else
set dataOn[udg_saveDataLength19] = 0
endif
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// Code length value 20 (Save) Among the data, information with a numeric value of 0 is excluded from the code.
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
set data[udg_saveDataLength20] = null
// The values ??compared to whether dataOn of each data is 0 or 1 are grouped into one string.
set loopA = 571
set loopExit = 1
loop
exitwhen (loopA > udg_saveDataN) or (loopExit > 30)
set data[udg_saveDataLength20] = I2S(dataOn[loopA]) + data[udg_saveDataLength20]
set loopExit = loopExit + 1
set loopA = loopA + 1
endloop
// Set the code length value to 20
if (ToInteger2(data[udg_saveDataLength20]) != 0) then
set data[udg_saveDataLength20] = ToNotation(ToInteger2(data[udg_saveDataLength20]))
else
set dataOn[udg_saveDataLength20] = 0
endif
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// Code length value 21 (Save) Among the data, information with a numeric value of 0 is excluded from the code.
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
set data[udg_saveDataLength21] = null
// The values ??compared to whether dataOn of each data is 0 or 1 are grouped into one string.
set loopA = 601
set loopExit = 1
loop
exitwhen (loopA > udg_saveDataN) or (loopExit > 30)
set data[udg_saveDataLength21] = I2S(dataOn[loopA]) + data[udg_saveDataLength21]
set loopExit = loopExit + 1
set loopA = loopA + 1
endloop
// Set the code length value to 21
if (ToInteger2(data[udg_saveDataLength21]) != 0) then
set data[udg_saveDataLength21] = ToNotation(ToInteger2(data[udg_saveDataLength21]))
else
set dataOn[udg_saveDataLength21] = 0
endif
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// Code length value 22 (Save) Among the data, information with a numeric value of 0 is excluded from the code.
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
set data[udg_saveDataLength22] = null
// The values ??compared to whether dataOn of each data is 0 or 1 are grouped into one string.
set loopA = 631
set loopExit = 1
loop
exitwhen (loopA > udg_saveDataN) or (loopExit > 30)
set data[udg_saveDataLength22] = I2S(dataOn[loopA]) + data[udg_saveDataLength22]
set loopExit = loopExit + 1
set loopA = loopA + 1
endloop
// Set the code length value to 22
if (ToInteger2(data[udg_saveDataLength22]) != 0) then
set data[udg_saveDataLength22] = ToNotation(ToInteger2(data[udg_saveDataLength22]))
else
set dataOn[udg_saveDataLength22] = 0
endif
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// Code length value 23 (Save) Among the data, information with a numeric value of 0 is excluded from the code.
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
set data[udg_saveDataLength23] = null
// The values ??compared to whether dataOn of each data is 0 or 1 are grouped into one string.
set loopA = 661
set loopExit = 1
loop
exitwhen (loopA > udg_saveDataN) or (loopExit > 30)
set data[udg_saveDataLength23] = I2S(dataOn[loopA]) + data[udg_saveDataLength23]
set loopExit = loopExit + 1
set loopA = loopA + 1
endloop
// Set the code length value to 23
if (ToInteger2(data[udg_saveDataLength23]) != 0) then
set data[udg_saveDataLength23] = ToNotation(ToInteger2(data[udg_saveDataLength23]))
else
set dataOn[udg_saveDataLength23] = 0
endif
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// Code length value 24 (Save) Among the data, information with a numeric value of 0 is excluded from the code.
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
set data[udg_saveDataLength24] = null
// The values ??compared to whether dataOn of each data is 0 or 1 are grouped into one string.
set loopA = 691
set loopExit = 1
loop
exitwhen (loopA > udg_saveDataN) or (loopExit > 30)
set data[udg_saveDataLength24] = I2S(dataOn[loopA]) + data[udg_saveDataLength24]
set loopExit = loopExit + 1
set loopA = loopA + 1
endloop
// Set the code length value to 24
if (ToInteger2(data[udg_saveDataLength24]) != 0) then
set data[udg_saveDataLength24] = ToNotation(ToInteger2(data[udg_saveDataLength24]))
else
set dataOn[udg_saveDataLength24] = 0
endif
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// Reorganize code length value 1 (Save)
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
set data[udg_saveDataLength1] = null
// The values ??compared to whether dataOn of each data is 0 or 1 are grouped into one string.
set loopA = 1
set loopExit = 1
loop
exitwhen (loopA > udg_saveDataN) or (loopExit > 30)
set data[udg_saveDataLength1] = I2S(dataOn[loopA]) + data[udg_saveDataLength1]
set loopExit = loopExit + 1
set loopA = loopA + 1
endloop
// Set the code length value to 1.
if (ToInteger2(data[udg_saveDataLength1]) != 0) then
set data[udg_saveDataLength1] = ToNotation(ToInteger2(data[udg_saveDataLength1]))
else
set dataOn[udg_saveDataLength1] = 0
endif
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// Code length check value (Save) Information with a value of 0 among the code length values ??is excluded from the code.
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
set data[udg_saveDataLengthCheck] = null
// The values ??compared to whether each code length value is 0 or greater than 1 are grouped into one string.
set loopA = udg_saveDataLength1
loop
exitwhen loopA > udg_saveDataLength24
if (ToInteger(data[loopA]) == 0) then
set data[udg_saveDataLengthCheck] = "0" + data[udg_saveDataLengthCheck]
else
set data[udg_saveDataLengthCheck] = "1" + data[udg_saveDataLengthCheck]
endif
set loopA = loopA + 1
endloop
// Set the code length check value.
set data[udg_saveDataLengthCheck] = ToNotation(ToInteger2(data[udg_saveDataLengthCheck]))
// Due to the nature of Warcraft, the function is forcibly terminated when the loop runs a certain amount, so wait for a while.
call TriggerSleepAction(0.01)
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// Encryption value (Save) When adding new data to the save list, set it above this comment.
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// Add the overall number to the cryptographic value in decimal.
set loopA = 1
loop
exitwhen loopA > udg_saveDataN
if (dataOn[loopA] == 1) and (loopA != udg_saveDataEncryption) then
set checkNum = checkNum + (ModuloInteger(ToInteger(data[loopA]), R2I(Pow(udg_keyLength, 2))) * (ModuloInteger(loopA, 5) + 1))
endif
if (ModuloInteger(loopA, 200) == 0) then
call TriggerSleepAction(0.01)
endif
set loopA = loopA + 1
endloop
// Appends the code version to the cryptographic value in decimal.
if (udg_saveDataVersion > 999) then
set checkNum = checkNum + ModuloInteger(udg_saveDataVersion, 1000)
else
set checkNum = checkNum + udg_saveDataVersion
endif
// Appends the name of the map to the cryptographic value in decimal.
set checkNum = checkNum + NameToInteger(udg_MapName)
// Adds the player's ID to the cryptographic value in decimal.
set checkNum = checkNum + NameToInteger(GetPlayerName(p))
// Convert the decimal encryption code to decimal and set data [encryption value].
set data[udg_saveDataEncryption] = ToNotation(checkNum)
// Due to the nature of Warcraft, the function is forcibly terminated when the loop runs a certain amount, so wait for a while.
call TriggerSleepAction(0.01)
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// Organize the length of the code appropriately. (Save) If you want to add new data to the save list, please set it above this comment.
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// Organize the length of the code appropriately.
set loopA = 1
loop
exitwhen loopA > udg_saveDataN
if (dataOn[loopA] == 1) then
set data[loopA] = CodeLength(data[loopA], udg_saveData[loopA])
set result = result + data[loopA]
endif
set loopA = loopA + 1
endloop
// Due to the nature of Warcraft, the function is forcibly terminated when the loop runs a certain amount, so wait for a while.
call TriggerSleepAction(0.01)
// If your code is longer than the chat input maximum of 127, split it into multiple lines.
set real1 = StringLength(result) / 127
if (real1 + 1 == R2I(real1) + 1) then
set loopExit = R2I(real1)
else
set loopExit = R2I(real1) + 1
endif
set loopA = 1
loop
exitwhen loopExit < 0
if (StringLength(result) < 127) then
set saveResult[loopA] = SubString(result, 0, StringLength(result))
else
set saveResult[loopA] = SubString(result, 0, 127)
endif
set result = SubString(result, 127, StringLength(result))
set loopA = loopA + 1
set loopExit = loopExit - 1
endloop
// Due to the nature of Warcraft, the function is forcibly terminated when the loop runs a certain amount, so wait for a while.
call TriggerSleepAction(0.01)
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// Prints the save code. (Save) If you want to add new data to the save list, please set it above this comment.
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// Bind the item.
call SetItemPlayer(UnitItemInSlot(hero, 0), p, false)
call SetItemPlayer(UnitItemInSlot(hero, 1), p, false)
call SetItemPlayer(UnitItemInSlot(hero, 2), p, false)
call SetItemPlayer(UnitItemInSlot(hero, 3), p, false)
call SetItemPlayer(UnitItemInSlot(hero, 4), p, false)
call SetItemPlayer(UnitItemInSlot(hero, 5), p, false)
call SetItemPlayer(UnitItemInSlot(bag, 0), p, false)
call SetItemPlayer(UnitItemInSlot(bag, 1), p, false)
call SetItemPlayer(UnitItemInSlot(bag, 2), p, false)
call SetItemPlayer(UnitItemInSlot(bag, 3), p, false)
call SetItemPlayer(UnitItemInSlot(bag, 4), p, false)
call SetItemPlayer(UnitItemInSlot(bag, 5), p, false)
// The save code is output as a message.
set loopA = 1
loop
exitwhen loopA > 30
call PrintCode(p, saveResult[loopA], loopA)
set loopA = loopA + 1
endloop
// Due to the nature of Warcraft, the function is forcibly terminated when the loop runs a certain amount, so wait for a while.
call TriggerSleepAction(0.01)
// Create a text file.
set loopA = 1
loop
exitwhen loopA > udg_saveDataN
if (dataTextString[loopA] != null) then
call SaveStr(udg_dataTextStringHash, GetHandleId(p), loopA, dataTextString[loopA])
else
call SaveStr(udg_dataTextStringHash, GetHandleId(p), loopA, "0")
endif
set loopA = loopA + 1
endloop
// Clean up your lines of code.
set loopA = 1
loop
exitwhen loopA > 30
if (saveResult[loopA] != null) then
call SaveStr(udg_makeFileHash, GetHandleId(p), loopA, saveResult[loopA])
endif
set loopA = loopA + 1
endloop
call MakeFile(p, message, I2S(GetUnitLevel(hero)))
set udg_codeSavingNow[GetConvertedPlayerId(p)] = false
// Set an empty space to secure the handle ID value.
set hero = null
set bag = null
endfunction
//************************************************************************************************************************************************************************
//*
//* load function
//*
//************************************************************************************************************************************************************************
function HeroLoad takes player p, string message returns boolean
local integer array data
local integer array dataOn
local integer array lengthOn
local integer dataStart
local string dataLength
local integer encryptionData = 0
local integer num
local integer num2
local real real1
local integer checkNum = 0
local integer loopA
local integer loopExit
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// Adds the entered code to udg_codeString. This variable is the total string of code in case the code is too long and breaks into lines. (Load)
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
set udg_codeString[GetConvertedPlayerId(p)] = udg_codeString[GetConvertedPlayerId(p)] + message
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// Code length check value (Load)
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
set dataStart = 0
// If this is the first code input, set the code length check value.
if (udg_codeTypingTick[GetConvertedPlayerId(p)] == 0) then
set udg_dataLengthCheck[GetConvertedPlayerId(p)] = SubString(message, dataStart, dataStart + udg_saveData[udg_saveDataLengthCheck])
endif
// Set dataLength to the code length check value.
set dataLength = CodeLength2(ToNotation2(ToInteger(udg_dataLengthCheck[GetConvertedPlayerId(p)])), 24)
// Sets whether code length values ??exist or not.
set loopA = 1
set loopExit = 24
loop
exitwhen (loopA + (udg_saveDataLength1 - 1) > udg_saveDataLength24) or (loopExit < 1)
set lengthOn[loopA + (udg_saveDataLength1 - 1)] = S2I(SubString(dataLength, loopExit - 1, loopExit))
set loopA = loopA + 1
set loopExit = loopExit - 1
endloop
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// Code length value 1 (Load)
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// If the code length value of 1 exists in the code, the following actions are executed.
if (lengthOn[udg_saveDataLength1] == 1) then
set dataStart = dataStart + 5
// If this is the first code input, set the code length value.
if (udg_codeTypingTick[GetConvertedPlayerId(p)] == 0) then
set udg_dataLength1[GetConvertedPlayerId(p)] = SubString(message, dataStart, dataStart + udg_saveData[udg_saveDataLength1])
endif
// Set dataLength to the code length value.
set dataLength = CodeLength2(ToNotation2(ToInteger(udg_dataLength1[GetConvertedPlayerId(p)])), 30)
// Compare the code length value and set whether each data is 1 or more or 0.
set loopA = 1
set loopExit = 30
loop
exitwhen (loopA > udg_saveDataN) or (loopExit < 1)
set dataOn[loopA] = S2I(SubString(dataLength, loopExit - 1, loopExit))
set loopA = loopA + 1
set loopExit = loopExit - 1
endloop
endif
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// Code length value 2 (Load)
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// If the code length value of 2 exists in the code, the following actions are executed.
if (lengthOn[udg_saveDataLength2] == 1) then
set dataStart = dataStart + 5
// If this is the first code input, set the code length value.
if (udg_codeTypingTick[GetConvertedPlayerId(p)] == 0) then
set udg_dataLength2[GetConvertedPlayerId(p)] = SubString(message, dataStart, dataStart + udg_saveData[udg_saveDataLength2])
endif
// Set dataLength to the code length value.
set dataLength = CodeLength2(ToNotation2(ToInteger(udg_dataLength2[GetConvertedPlayerId(p)])), 30)
// Compare the code length value and set whether each data is 1 or more or 0.
set loopA = 31
set loopExit = 30
loop
exitwhen (loopA > udg_saveDataN) or (loopExit < 1)
set dataOn[loopA] = S2I(SubString(dataLength, loopExit - 1, loopExit))
set loopA = loopA + 1
set loopExit = loopExit - 1
endloop
endif
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// Code length value 3 (Load)
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// If the code length value of 3 exists in the code, the following actions are executed.
if (lengthOn[udg_saveDataLength3] == 1) then
set dataStart = dataStart + 5
// If this is the first code input, set the code length value.
if (udg_codeTypingTick[GetConvertedPlayerId(p)] == 0) then
set udg_dataLength3[GetConvertedPlayerId(p)] = SubString(message, dataStart, dataStart + udg_saveData[udg_saveDataLength3])
endif
// Set dataLength to the code length value.
set dataLength = CodeLength2(ToNotation2(ToInteger(udg_dataLength3[GetConvertedPlayerId(p)])), 30)
// Compare the code length value and set whether each data is 1 or more or 0.
set loopA = 61
set loopExit = 30
loop
exitwhen (loopA > udg_saveDataN) or (loopExit < 1)
set dataOn[loopA] = S2I(SubString(dataLength, loopExit - 1, loopExit))
set loopA = loopA + 1
set loopExit = loopExit - 1
endloop
endif
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// Code length value 4 (Load)
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// If the code length value of 4 exists in the code, the following actions are executed.
if (lengthOn[udg_saveDataLength4] == 1) then
set dataStart = dataStart + 5
// If this is the first code input, set the code length value.
if (udg_codeTypingTick[GetConvertedPlayerId(p)] == 0) then
set udg_dataLength4[GetConvertedPlayerId(p)] = SubString(message, dataStart, dataStart + udg_saveData[udg_saveDataLength4])
endif
// Set dataLength to the code length value.
set dataLength = CodeLength2(ToNotation2(ToInteger(udg_dataLength4[GetConvertedPlayerId(p)])), 30)
// Compare the code length value and set whether each data is 1 or more or 0.
set loopA = 91
set loopExit = 30
loop
exitwhen (loopA > udg_saveDataN) or (loopExit < 1)
set dataOn[loopA] = S2I(SubString(dataLength, loopExit - 1, loopExit))
set loopA = loopA + 1
set loopExit = loopExit - 1
endloop
endif
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// Code length value 5 (Load)
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// If the code length value of 5 exists in the code, the following actions are executed.
if (lengthOn[udg_saveDataLength5] == 1) then
set dataStart = dataStart + 5
// If this is the first code input, set the code length value.
if (udg_codeTypingTick[GetConvertedPlayerId(p)] == 0) then
set udg_dataLength5[GetConvertedPlayerId(p)] = SubString(message, dataStart, dataStart + udg_saveData[udg_saveDataLength5])
endif
// Set dataLength to the code length value.
set dataLength = CodeLength2(ToNotation2(ToInteger(udg_dataLength5[GetConvertedPlayerId(p)])), 30)
// Compare the code length value and set whether each data is 1 or more or 0.
set loopA = 121
set loopExit = 30
loop
exitwhen (loopA > udg_saveDataN) or (loopExit < 1)
set dataOn[loopA] = S2I(SubString(dataLength, loopExit - 1, loopExit))
set loopA = loopA + 1
set loopExit = loopExit - 1
endloop
endif
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// Code length value 6 (Load)
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// If the code length value of 6 exists in the code, the following actions are executed.
if (lengthOn[udg_saveDataLength6] == 1) then
set dataStart = dataStart + 5
// If this is the first code input, set the code length value.
if (udg_codeTypingTick[GetConvertedPlayerId(p)] == 0) then
set udg_dataLength6[GetConvertedPlayerId(p)] = SubString(message, dataStart, dataStart + udg_saveData[udg_saveDataLength6])
endif
// Set dataLength to the code length value.
set dataLength = CodeLength2(ToNotation2(ToInteger(udg_dataLength6[GetConvertedPlayerId(p)])), 30)
// Compare the code length value and set whether each data is 1 or more or 0.
set loopA = 151
set loopExit = 30
loop
exitwhen (loopA > udg_saveDataN) or (loopExit < 1)
set dataOn[loopA] = S2I(SubString(dataLength, loopExit - 1, loopExit))
set loopA = loopA + 1
set loopExit = loopExit - 1
endloop
endif
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// Code length value 7 (Load)
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// If the code length value of 7 exists in the code, the following actions are executed.
if (lengthOn[udg_saveDataLength7] == 1) then
set dataStart = dataStart + 5
// If this is the first code input, set the code length value.
if (udg_codeTypingTick[GetConvertedPlayerId(p)] == 0) then
set udg_dataLength7[GetConvertedPlayerId(p)] = SubString(message, dataStart, dataStart + udg_saveData[udg_saveDataLength7])
endif
// Set dataLength to the code length value.
set dataLength = CodeLength2(ToNotation2(ToInteger(udg_dataLength7[GetConvertedPlayerId(p)])), 30)
// Compare the code length value and set whether each data is 1 or more or 0.
set loopA = 181
set loopExit = 30
loop
exitwhen (loopA > udg_saveDataN) or (loopExit < 1)
set dataOn[loopA] = S2I(SubString(dataLength, loopExit - 1, loopExit))
set loopA = loopA + 1
set loopExit = loopExit - 1
endloop
endif
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// Code length value 8 (Load)
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// If the code length value of 8 exists in the code, the following actions are executed.
if (lengthOn[udg_saveDataLength8] == 1) then
set dataStart = dataStart + 5
// If this is the first code input, set the code length value.
if (udg_codeTypingTick[GetConvertedPlayerId(p)] == 0) then
set udg_dataLength8[GetConvertedPlayerId(p)] = SubString(message, dataStart, dataStart + udg_saveData[udg_saveDataLength8])
endif
// Set dataLength to the code length value.
set dataLength = CodeLength2(ToNotation2(ToInteger(udg_dataLength8[GetConvertedPlayerId(p)])), 30)
// Compare the code length value and set whether each data is 1 or more or 0.
set loopA = 211
set loopExit = 30
loop
exitwhen (loopA > udg_saveDataN) or (loopExit < 1)
set dataOn[loopA] = S2I(SubString(dataLength, loopExit - 1, loopExit))
set loopA = loopA + 1
set loopExit = loopExit - 1
endloop
endif
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// Code length value 9 (Load)
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// If the code length value of 9 exists in the code, the following actions are executed.
if (lengthOn[udg_saveDataLength9] == 1) then
set dataStart = dataStart + 5
// If this is the first code input, set the code length value.
if (udg_codeTypingTick[GetConvertedPlayerId(p)] == 0) then
set udg_dataLength9[GetConvertedPlayerId(p)] = SubString(message, dataStart, dataStart + udg_saveData[udg_saveDataLength9])
endif
// Set dataLength to the code length value.
set dataLength = CodeLength2(ToNotation2(ToInteger(udg_dataLength9[GetConvertedPlayerId(p)])), 30)
// Compare the code length value and set whether each data is 1 or more or 0.
set loopA = 241
set loopExit = 30
loop
exitwhen (loopA > udg_saveDataN) or (loopExit < 1)
set dataOn[loopA] = S2I(SubString(dataLength, loopExit - 1, loopExit))
set loopA = loopA + 1
set loopExit = loopExit - 1
endloop
endif
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// Code length value 10 (Load)
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// If the code length value of 10 exists in the code, the following actions are executed.
if (lengthOn[udg_saveDataLength10] == 1) then
set dataStart = dataStart + 5
// If this is the first code input, set the code length value.
if (udg_codeTypingTick[GetConvertedPlayerId(p)] == 0) then
set udg_dataLength10[GetConvertedPlayerId(p)] = SubString(message, dataStart, dataStart + udg_saveData[udg_saveDataLength10])
endif
// Set dataLength to the code length value.
set dataLength = CodeLength2(ToNotation2(ToInteger(udg_dataLength10[GetConvertedPlayerId(p)])), 30)
// Compare the code length value and set whether each data is 1 or more or 0.
set loopA = 271
set loopExit = 30
loop
exitwhen (loopA > udg_saveDataN) or (loopExit < 1)
set dataOn[loopA] = S2I(SubString(dataLength, loopExit - 1, loopExit))
set loopA = loopA + 1
set loopExit = loopExit - 1
endloop
endif
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// Code length value 11 (Load)
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// If the code length value of 11 exists in the code, the following actions are executed.
if (lengthOn[udg_saveDataLength11] == 1) then
set dataStart = dataStart + 5
// If this is the first code input, set the code length value.
if (udg_codeTypingTick[GetConvertedPlayerId(p)] == 0) then
set udg_dataLength11[GetConvertedPlayerId(p)] = SubString(message, dataStart, dataStart + udg_saveData[udg_saveDataLength11])
endif
// Set dataLength to the code length value.
set dataLength = CodeLength2(ToNotation2(ToInteger(udg_dataLength11[GetConvertedPlayerId(p)])), 30)
// Compare the code length value and set whether each data is 1 or more or 0.
set loopA = 301
set loopExit = 30
loop
exitwhen (loopA > udg_saveDataN) or (loopExit < 1)
set dataOn[loopA] = S2I(SubString(dataLength, loopExit - 1, loopExit))
set loopA = loopA + 1
set loopExit = loopExit - 1
endloop
endif
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// Code length value 12 (Load)
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// If the code length value of 12 exists in the code, the following actions are executed.
if (lengthOn[udg_saveDataLength12] == 1) then
set dataStart = dataStart + 5
// If this is the first code input, set the code length value.
if (udg_codeTypingTick[GetConvertedPlayerId(p)] == 0) then
set udg_dataLength12[GetConvertedPlayerId(p)] = SubString(message, dataStart, dataStart + udg_saveData[udg_saveDataLength12])
endif
// Set dataLength to the code length value.
set dataLength = CodeLength2(ToNotation2(ToInteger(udg_dataLength12[GetConvertedPlayerId(p)])), 30)
// Compare the code length value and set whether each data is 1 or more or 0.
set loopA = 331
set loopExit = 30
loop
exitwhen (loopA > udg_saveDataN) or (loopExit < 1)
set dataOn[loopA] = S2I(SubString(dataLength, loopExit - 1, loopExit))
set loopA = loopA + 1
set loopExit = loopExit - 1
endloop
endif
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// Code length value 13 (Load)
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// If the code length value of 13 exists in the code, the following actions are executed.
if (lengthOn[udg_saveDataLength13] == 1) then
set dataStart = dataStart + 5
// If this is the first code input, set the code length value.
if (udg_codeTypingTick[GetConvertedPlayerId(p)] == 0) then
set udg_dataLength13[GetConvertedPlayerId(p)] = SubString(message, dataStart, dataStart + udg_saveData[udg_saveDataLength13])
endif
// Set dataLength to the code length value.
set dataLength = CodeLength2(ToNotation2(ToInteger(udg_dataLength13[GetConvertedPlayerId(p)])), 30)
// Compare the code length value and set whether each data is 1 or more or 0.
set loopA = 361
set loopExit = 30
loop
exitwhen (loopA > udg_saveDataN) or (loopExit < 1)
set dataOn[loopA] = S2I(SubString(dataLength, loopExit - 1, loopExit))
set loopA = loopA + 1
set loopExit = loopExit - 1
endloop
endif
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// Code length value 14 (Load)
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// If the code length value of 14 exists in the code, the following actions are executed.
if (lengthOn[udg_saveDataLength14] == 1) then
set dataStart = dataStart + 5
// If this is the first code input, set the code length value.
if (udg_codeTypingTick[GetConvertedPlayerId(p)] == 0) then
set udg_dataLength14[GetConvertedPlayerId(p)] = SubString(message, dataStart, dataStart + udg_saveData[udg_saveDataLength14])
endif
// Set dataLength to the code length value.
set dataLength = CodeLength2(ToNotation2(ToInteger(udg_dataLength14[GetConvertedPlayerId(p)])), 30)
// Compare the code length value and set whether each data is 1 or more or 0.
set loopA = 391
set loopExit = 30
loop
exitwhen (loopA > udg_saveDataN) or (loopExit < 1)
set dataOn[loopA] = S2I(SubString(dataLength, loopExit - 1, loopExit))
set loopA = loopA + 1
set loopExit = loopExit - 1
endloop
endif
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// Code length value 15 (Load)
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// If the code length value of 15 exists in the code, the following actions are executed.
if (lengthOn[udg_saveDataLength15] == 1) then
set dataStart = dataStart + 5
// If this is the first code input, set the code length value.
if (udg_codeTypingTick[GetConvertedPlayerId(p)] == 0) then
set udg_dataLength15[GetConvertedPlayerId(p)] = SubString(message, dataStart, dataStart + udg_saveData[udg_saveDataLength15])
endif
// Set dataLength to the code length value.
set dataLength = CodeLength2(ToNotation2(ToInteger(udg_dataLength15[GetConvertedPlayerId(p)])), 30)
// Compare the code length value and set whether each data is 1 or more or 0.
set loopA = 421
set loopExit = 30
loop
exitwhen (loopA > udg_saveDataN) or (loopExit < 1)
set dataOn[loopA] = S2I(SubString(dataLength, loopExit - 1, loopExit))
set loopA = loopA + 1
set loopExit = loopExit - 1
endloop
endif
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// Code length value 16 (Load)
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// If the code length value of 16 exists in the code, the following actions are executed.
if (lengthOn[udg_saveDataLength16] == 1) then
set dataStart = dataStart + 5
// If this is the first code input, set the code length value.
if (udg_codeTypingTick[GetConvertedPlayerId(p)] == 0) then
set udg_dataLength16[GetConvertedPlayerId(p)] = SubString(message, dataStart, dataStart + udg_saveData[udg_saveDataLength16])
endif
// Set dataLength to the code length value.
set dataLength = CodeLength2(ToNotation2(ToInteger(udg_dataLength16[GetConvertedPlayerId(p)])), 30)
// Compare the code length value and set whether each data is 1 or more or 0.
set loopA = 451
set loopExit = 30
loop
exitwhen (loopA > udg_saveDataN) or (loopExit < 1)
set dataOn[loopA] = S2I(SubString(dataLength, loopExit - 1, loopExit))
set loopA = loopA + 1
set loopExit = loopExit - 1
endloop
endif
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// Code length value 17 (Load)
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// If the code length value of 17 exists in the code, the following actions are executed.
if (lengthOn[udg_saveDataLength17] == 1) then
set dataStart = dataStart + 5
// If this is the first code input, set the code length value.
if (udg_codeTypingTick[GetConvertedPlayerId(p)] == 0) then
set udg_dataLength17[GetConvertedPlayerId(p)] = SubString(message, dataStart, dataStart + udg_saveData[udg_saveDataLength17])
endif
// Set dataLength to the code length value.
set dataLength = CodeLength2(ToNotation2(ToInteger(udg_dataLength17[GetConvertedPlayerId(p)])), 30)
// Compare the code length value and set whether each data is 1 or more or 0.
set loopA = 481
set loopExit = 30
loop
exitwhen (loopA > udg_saveDataN) or (loopExit < 1)
set dataOn[loopA] = S2I(SubString(dataLength, loopExit - 1, loopExit))
set loopA = loopA + 1
set loopExit = loopExit - 1
endloop
endif
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// Code length value 18 (Load)
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// If the code length value of 18 exists in the code, the following actions are executed.
if (lengthOn[udg_saveDataLength18] == 1) then
set dataStart = dataStart + 5
// If this is the first code input, set the code length value.
if (udg_codeTypingTick[GetConvertedPlayerId(p)] == 0) then
set udg_dataLength18[GetConvertedPlayerId(p)] = SubString(message, dataStart, dataStart + udg_saveData[udg_saveDataLength18])
endif
// Set dataLength to the code length value.
set dataLength = CodeLength2(ToNotation2(ToInteger(udg_dataLength18[GetConvertedPlayerId(p)])), 30)
// Compare the code length value and set whether each data is 1 or more or 0.
set loopA = 511
set loopExit = 30
loop
exitwhen (loopA > udg_saveDataN) or (loopExit < 1)
set dataOn[loopA] = S2I(SubString(dataLength, loopExit - 1, loopExit))
set loopA = loopA + 1
set loopExit = loopExit - 1
endloop
endif
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// Code length value 19 (Load)
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// If the code length value of 19 exists in the code, the following actions are executed.
if (lengthOn[udg_saveDataLength19] == 1) then
set dataStart = dataStart + 5
// If this is the first code input, set the code length value.
if (udg_codeTypingTick[GetConvertedPlayerId(p)] == 0) then
set udg_dataLength19[GetConvertedPlayerId(p)] = SubString(message, dataStart, dataStart + udg_saveData[udg_saveDataLength19])
endif
// Set dataLength to the code length value.
set dataLength = CodeLength2(ToNotation2(ToInteger(udg_dataLength19[GetConvertedPlayerId(p)])), 30)
// Compare the code length value and set whether each data is 1 or more or 0.
set loopA = 541
set loopExit = 30
loop
exitwhen (loopA > udg_saveDataN) or (loopExit < 1)
set dataOn[loopA] = S2I(SubString(dataLength, loopExit - 1, loopExit))
set loopA = loopA + 1
set loopExit = loopExit - 1
endloop
endif
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// Code length value 20 (Load)
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// If the code length value of 20 exists in the code, the following actions are executed.
if (lengthOn[udg_saveDataLength20] == 1) then
set dataStart = dataStart + 5
// If this is the first code input, set the code length value.
if (udg_codeTypingTick[GetConvertedPlayerId(p)] == 0) then
set udg_dataLength20[GetConvertedPlayerId(p)] = SubString(message, dataStart, dataStart + udg_saveData[udg_saveDataLength20])
endif
// Set dataLength to the code length value.
set dataLength = CodeLength2(ToNotation2(ToInteger(udg_dataLength20[GetConvertedPlayerId(p)])), 30)
// Compare the code length value and set whether each data is 1 or more or 0.
set loopA = 571
set loopExit = 30
loop
exitwhen (loopA > udg_saveDataN) or (loopExit < 1)
set dataOn[loopA] = S2I(SubString(dataLength, loopExit - 1, loopExit))
set loopA = loopA + 1
set loopExit = loopExit - 1
endloop
endif
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// Code length value 21 (Load)
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// If the code length value of 21 exists in the code, the following actions are executed.
if (lengthOn[udg_saveDataLength21] == 1) then
set dataStart = dataStart + 5
// If this is the first code input, set the code length value.
if (udg_codeTypingTick[GetConvertedPlayerId(p)] == 0) then
set udg_dataLength21[GetConvertedPlayerId(p)] = SubString(message, dataStart, dataStart + udg_saveData[udg_saveDataLength21])
endif
// Set dataLength to the code length value.
set dataLength = CodeLength2(ToNotation2(ToInteger(udg_dataLength21[GetConvertedPlayerId(p)])), 30)
// Compare the code length value and set whether each data is 1 or more or 0.
set loopA = 601
set loopExit = 30
loop
exitwhen (loopA > udg_saveDataN) or (loopExit < 1)
set dataOn[loopA] = S2I(SubString(dataLength, loopExit - 1, loopExit))
set loopA = loopA + 1
set loopExit = loopExit - 1
endloop
endif
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// Code length value 22 (Load)
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// If the code length value of 22 exists in the code, the following actions are executed.
if (lengthOn[udg_saveDataLength22] == 1) then
set dataStart = dataStart + 5
// If this is the first code input, set the code length value.
if (udg_codeTypingTick[GetConvertedPlayerId(p)] == 0) then
set udg_dataLength22[GetConvertedPlayerId(p)] = SubString(message, dataStart, dataStart + udg_saveData[udg_saveDataLength22])
endif
// Set dataLength to the code length value.
set dataLength = CodeLength2(ToNotation2(ToInteger(udg_dataLength22[GetConvertedPlayerId(p)])), 30)
// Compare the code length value and set whether each data is 1 or more or 0.
set loopA = 631
set loopExit = 30
loop
exitwhen (loopA > udg_saveDataN) or (loopExit < 1)
set dataOn[loopA] = S2I(SubString(dataLength, loopExit - 1, loopExit))
set loopA = loopA + 1
set loopExit = loopExit - 1
endloop
endif
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// Code length value 23 (Load)
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// If the code length value of 23 exists in the code, the following actions are executed.
if (lengthOn[udg_saveDataLength23] == 1) then
set dataStart = dataStart + 5
// If this is the first code input, set the code length value.
if (udg_codeTypingTick[GetConvertedPlayerId(p)] == 0) then
set udg_dataLength23[GetConvertedPlayerId(p)] = SubString(message, dataStart, dataStart + udg_saveData[udg_saveDataLength23])
endif
// Set dataLength to the code length value.
set dataLength = CodeLength2(ToNotation2(ToInteger(udg_dataLength23[GetConvertedPlayerId(p)])), 30)
// Compare the code length value and set whether each data is 1 or more or 0.
set loopA = 661
set loopExit = 30
loop
exitwhen (loopA > udg_saveDataN) or (loopExit < 1)
set dataOn[loopA] = S2I(SubString(dataLength, loopExit - 1, loopExit))
set loopA = loopA + 1
set loopExit = loopExit - 1
endloop
endif
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// Code length value 24 (Load)
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// If the code length value of 24 exists in the code, the following actions are executed.
if (lengthOn[udg_saveDataLength24] == 1) then
set dataStart = dataStart + 5
// If this is the first code input, set the code length value.
if (udg_codeTypingTick[GetConvertedPlayerId(p)] == 0) then
set udg_dataLength24[GetConvertedPlayerId(p)] = SubString(message, dataStart, dataStart + udg_saveData[udg_saveDataLength24])
endif
// Set dataLength to the code length value.
set dataLength = CodeLength2(ToNotation2(ToInteger(udg_dataLength24[GetConvertedPlayerId(p)])), 30)
// Compare the code length value and set whether each data is 1 or more or 0.
set loopA = 691
set loopExit = 30
loop
exitwhen (loopA > udg_saveDataN) or (loopExit < 1)
set dataOn[loopA] = S2I(SubString(dataLength, loopExit - 1, loopExit))
set loopA = loopA + 1
set loopExit = loopExit - 1
endloop
endif
// Due to the nature of Warcraft, the function is forcibly terminated when the loop runs a certain amount, so wait for a while.
call TriggerSleepAction(0.01)
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// If there are multiple lines of code, combine them. (Load)
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
set num = 0
set loopA = 1
loop
exitwhen loopA > udg_saveDataN
if (dataOn[loopA] == 1) then
set num = num + udg_saveData[loopA]
endif
set loopA = loopA + 1
endloop
// Due to the nature of Warcraft, the function is forcibly terminated when the loop runs a certain amount, so wait for a while.
call TriggerSleepAction(0.01)
// When entering code for the first time, set how many lines of code there are.
if (udg_codeTypingTick[GetConvertedPlayerId(p)] == 0) then
set udg_codeLine[GetConvertedPlayerId(p)] = R2I(I2R(num) / 127.0)
endif
// If there are more lines of code remaining, the message you entered will be added to the code and stopped.
if (udg_codeLine[GetConvertedPlayerId(p)] > 0) then
set udg_codeLine[GetConvertedPlayerId(p)] = udg_codeLine[GetConvertedPlayerId(p)] - 1
set udg_codeTypingTick[GetConvertedPlayerId(p)] = udg_codeTypingTick[GetConvertedPlayerId(p)] + 1
call DisplayTimedTextToPlayer(GetTriggerPlayer(), 0.0, 0.0, 3.0, "|c00DFFB4F" + I2S(udg_codeTypingTick[GetConvertedPlayerId(p)] + 1) + "Enter the save code in the first line.|r")
set udg_codeLoadingNow[GetConvertedPlayerId(p)] = false
return false
endif
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// Load data (Load)
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
set num = 0
// Load all data in your code.
set loopA = 1
loop
exitwhen loopA > udg_saveDataN
if (dataOn[loopA] == 1) then
set data[loopA] = ToInteger(SubString(udg_codeString[GetConvertedPlayerId(p)], num, num + udg_saveData[loopA]))
// If the data is an encryption value, set the encryption code entered by the player.
if (loopA == udg_saveDataEncryption) then
set encryptionData = ToInteger(SubString(udg_codeString[GetConvertedPlayerId(p)], num, num + udg_saveData[loopA]))
endif
set num = num + udg_saveData[loopA]
endif
if (ModuloInteger(loopA, 100) == 0) then
call TriggerSleepAction(0.01)
endif
set loopA = loopA + 1
endloop
// Due to the nature of Warcraft, the function is forcibly terminated when the loop runs a certain amount, so wait for a while.
call TriggerSleepAction(0.01)
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// Verify that the encryption value is correct. (Load)
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
set num = 0
set num2 = 0
// Add the overall number to the cryptographic value in decimal.
set loopA = 1
loop
exitwhen loopA > udg_saveDataN
if (dataOn[loopA] == 1) and (loopA != udg_saveDataEncryption) then
set checkNum = checkNum + (ModuloInteger(data[loopA], R2I(Pow(udg_keyLength, 2))) * (ModuloInteger(loopA, 5) + 1))
endif
set loopA = loopA + 1
endloop
// Appends the code version to the cryptographic value in decimal.
if (udg_saveDataVersion > 999) then
set checkNum = checkNum + ModuloInteger(udg_saveDataVersion, 1000)
else
set checkNum = checkNum + udg_saveDataVersion
endif
// Appends the name of the map to the cryptographic value in decimal.
set checkNum = checkNum + NameToInteger(udg_MapName)
// Adds the player's ID to the cryptographic value in decimal.
set checkNum = checkNum + NameToInteger(GetPlayerName(p))
// If the decimal encryption value and the entered encryption code value are different, loading stops.
if (checkNum != encryptionData) then
call DisplayTimedTextToPlayer(p, 0.0, 0.0, 10.0, "|cffFF0202Error) |c00DFFB4FThe ID is different or the code is incorrect.|r")
set udg_codeTyping[GetConvertedPlayerId(p)] = false
set udg_codeLoadingNow[GetConvertedPlayerId(p)] = false
return false
endif
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// Check if the data is the correct value. (Load)
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// The hero's unit type is setup HeroItem If it does not exist in the array set in the trigger, loading stops.
if (udg_saveHero[data[udg_saveDataHeroType]] == 0) then
call DisplayTimedTextToPlayer(p, 0.0, 0.0, 10.0, "|cffFF0202Error) |c00DFFB4FWrong unit type.|r")
set udg_codeTyping[GetConvertedPlayerId(p)] = false
set udg_codeLoadingNow[GetConvertedPlayerId(p)] = false
return false
endif
// The hero's 1th slot item type is setup HeroItem If it does not exist in the array set in the trigger, loading stops.
if (data[udg_saveDataHeroItem1] != 0) then
if (udg_saveItem[data[udg_saveDataHeroItem1]] == 0) then
call DisplayTimedTextToPlayer(p, 0.0, 0.0, 10.0, "|cffFF0202Error) |c00DFFB4FInvalid item type.|r")
set udg_codeTyping[GetConvertedPlayerId(p)] = false
set udg_codeLoadingNow[GetConvertedPlayerId(p)] = false
return false
endif
endif
// The hero's 2th slot item type is setup HeroItem If it does not exist in the array set in the trigger, loading stops.
if (data[udg_saveDataHeroItem2] != 0) then
if (udg_saveItem[data[udg_saveDataHeroItem2]] == 0) then
call DisplayTimedTextToPlayer(p, 0.0, 0.0, 10.0, "|cffFF0202Error) |c00DFFB4FInvalid item type.|r")
set udg_codeTyping[GetConvertedPlayerId(p)] = false
set udg_codeLoadingNow[GetConvertedPlayerId(p)] = false
return false
endif
endif
// The hero's 3th slot item type is setup HeroItem If it does not exist in the array set in the trigger, loading stops.
if (data[udg_saveDataHeroItem3] != 0) then
if (udg_saveItem[data[udg_saveDataHeroItem3]] == 0) then
call DisplayTimedTextToPlayer(p, 0.0, 0.0, 10.0, "|cffFF0202Error) |c00DFFB4FInvalid item type.|r")
set udg_codeTyping[GetConvertedPlayerId(p)] = false
set udg_codeLoadingNow[GetConvertedPlayerId(p)] = false
return false
endif
endif
// The hero's 4th slot item type is setup HeroItem If it does not exist in the array set in the trigger, loading stops.
if (data[udg_saveDataHeroItem4] != 0) then
if (udg_saveItem[data[udg_saveDataHeroItem4]] == 0) then
call DisplayTimedTextToPlayer(p, 0.0, 0.0, 10.0, "|cffFF0202Error) |c00DFFB4FInvalid item type.|r")
set udg_codeTyping[GetConvertedPlayerId(p)] = false
set udg_codeLoadingNow[GetConvertedPlayerId(p)] = false
return false
endif
endif
// The hero's 5th slot item type is setup HeroItem If it does not exist in the array set in the trigger, loading stops.
if (data[udg_saveDataHeroItem5] != 0) then
if (udg_saveItem[data[udg_saveDataHeroItem5]] == 0) then
call DisplayTimedTextToPlayer(p, 0.0, 0.0, 10.0, "|cffFF0202Error) |c00DFFB4FInvalid item type.|r")
set udg_codeTyping[GetConvertedPlayerId(p)] = false
set udg_codeLoadingNow[GetConvertedPlayerId(p)] = false
return false
endif
endif
// The hero's 6th slot item type is setup HeroItem If it does not exist in the array set in the trigger, loading stops.
if (data[udg_saveDataHeroItem6] != 0) then
if (udg_saveItem[data[udg_saveDataHeroItem6]] == 0) then
call DisplayTimedTextToPlayer(p, 0.0, 0.0, 10.0, "|cffFF0202Error) |c00DFFB4FInvalid item type.|r")
set udg_codeTyping[GetConvertedPlayerId(p)] = false
set udg_codeLoadingNow[GetConvertedPlayerId(p)] = false
return false
endif
endif
// The backpack's 1th slot item type is setup HeroItem If it does not exist in the array set in the trigger, loading stops.
if (data[udg_saveDataBagItem1] != 0) then
if (udg_saveItem[data[udg_saveDataBagItem1]] == 0) then
call DisplayTimedTextToPlayer(p, 0.0, 0.0, 10.0, "|cffFF0202Error) |c00DFFB4FInvalid item type.|r")
set udg_codeTyping[GetConvertedPlayerId(p)] = false
set udg_codeLoadingNow[GetConvertedPlayerId(p)] = false
return false
endif
endif
// The backpack's 2th slot item type is setup HeroItem If it does not exist in the array set in the trigger, loading stops.
if (data[udg_saveDataBagItem2] != 0) then
if (udg_saveItem[data[udg_saveDataBagItem2]] == 0) then
call DisplayTimedTextToPlayer(p, 0.0, 0.0, 10.0, "|cffFF0202Error) |c00DFFB4FInvalid item type.|r")
set udg_codeTyping[GetConvertedPlayerId(p)] = false
set udg_codeLoadingNow[GetConvertedPlayerId(p)] = false
return false
endif
endif
// The backpack's 3th slot item type is setup HeroItem If it does not exist in the array set in the trigger, loading stops.
if (data[udg_saveDataBagItem3] != 0) then
if (udg_saveItem[data[udg_saveDataBagItem3]] == 0) then
call DisplayTimedTextToPlayer(p, 0.0, 0.0, 10.0, "|cffFF0202Error) |c00DFFB4FInvalid item type.|r")
set udg_codeTyping[GetConvertedPlayerId(p)] = false
set udg_codeLoadingNow[GetConvertedPlayerId(p)] = false
return false
endif
endif
// The backpack's 4th slot item type is setup HeroItem If it does not exist in the array set in the trigger, loading stops.
if (data[udg_saveDataBagItem4] != 0) then
if (udg_saveItem[data[udg_saveDataBagItem4]] == 0) then
call DisplayTimedTextToPlayer(p, 0.0, 0.0, 10.0, "|cffFF0202Error) |c00DFFB4FInvalid item type.|r")
set udg_codeTyping[GetConvertedPlayerId(p)] = false
set udg_codeLoadingNow[GetConvertedPlayerId(p)] = false
return false
endif
endif
// The backpack's 5th slot item type is setup HeroItem If it does not exist in the array set in the trigger, loading stops.
if (data[udg_saveDataBagItem5] != 0) then
if (udg_saveItem[data[udg_saveDataBagItem5]] == 0) then
call DisplayTimedTextToPlayer(p, 0.0, 0.0, 10.0, "|cffFF0202Error) |c00DFFB4FInvalid item type.|r")
set udg_codeTyping[GetConvertedPlayerId(p)] = false
set udg_codeLoadingNow[GetConvertedPlayerId(p)] = false
return false
endif
endif
// The backpack's 6th slot item type is setup HeroItem If it does not exist in the array set in the trigger, loading stops.
if (data[udg_saveDataBagItem6] != 0) then
if (udg_saveItem[data[udg_saveDataBagItem6]] == 0) then
call DisplayTimedTextToPlayer(p, 0.0, 0.0, 10.0, "|cffFF0202Error) |c00DFFB4FInvalid item type.|r")
set udg_codeTyping[GetConvertedPlayerId(p)] = false
set udg_codeLoadingNow[GetConvertedPlayerId(p)] = false
return false
endif
endif
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// Complete loading. (Load)
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// All loaded information is stored in a hash table to be applied to the game in the Load trigger.
set loopA = 1
loop
exitwhen loopA > udg_saveDataN
call SaveInteger(udg_dataHash, GetConvertedPlayerId(p), loopA, data[loopA])
set loopA = loopA + 1
endloop
// Move the camera to the player start position.
call PanCameraToTimedForPlayer(p, GetLocationX(GetStartLocationLoc(GetPlayerStartLocation(p))), GetLocationY(GetStartLocationLoc(GetPlayerStartLocation(p))), 0.5)
// Prints a load completion message.
call DisplayTimedTextToPlayer(p, 0.0, 0.0, 10.0, "|c00DFFB4FLoaded!|r")
set udg_codeLoadingNow[GetConvertedPlayerId(p)] = false
set udg_codeTyping[GetConvertedPlayerId(p)] = false
return true
endfunction
Name | Type | is_array | initial_value |
afkPreventAnswer | integer | No | |
afkPreventBoolean | boolean | Yes | |
afkPreventTick | integer | No | |
AFKPreventTime | real | No | |
afkPreventTimer | timer | No | |
afkPreventTimerWindow | timerdialog | No | |
alphaToNormalHash | hashtable | No | |
bag | unit | Yes | |
bagUnitType | unitcode | No | |
bagZoneLoc | location | Yes | |
bagZoneRect | rect | Yes | |
bigAlphabetChar | string | No | |
camDistance | integer | Yes | 1650 |
cleanBoolean | boolean | No | |
cleanTimer | timer | No | |
cleanTimerdialog | timerdialog | No | |
codeLine | integer | Yes | |
codeLoadingNow | boolean | Yes | |
codeSavingNow | boolean | Yes | |
codeString | string | Yes | |
codeTyping | boolean | Yes | |
codeTypingTick | integer | Yes | |
damagePrintAction | triggeraction | No | |
data | integer | Yes | |
dataHash | hashtable | No | |
dataLength1 | string | Yes | |
dataLength10 | string | Yes | |
dataLength11 | string | Yes | |
dataLength12 | string | Yes | |
dataLength13 | string | Yes | |
dataLength14 | string | Yes | |
dataLength15 | string | Yes | |
dataLength16 | string | Yes | |
dataLength17 | string | Yes | |
dataLength18 | string | Yes | |
dataLength19 | string | Yes | |
dataLength2 | string | Yes | |
dataLength20 | string | Yes | |
dataLength21 | string | Yes | |
dataLength22 | string | Yes | |
dataLength23 | string | Yes | |
dataLength24 | string | Yes | |
dataLength3 | string | Yes | |
dataLength4 | string | Yes | |
dataLength5 | string | Yes | |
dataLength6 | string | Yes | |
dataLength7 | string | Yes | |
dataLength8 | string | Yes | |
dataLength9 | string | Yes | |
dataLengthCheck | string | Yes | |
dataTextStringHash | hashtable | No | |
dummyToAlphaHash | hashtable | No | |
fileSaveDialog | dialog | No | |
fileSaveTimer | timer | No | |
hero | unit | Yes | |
keyFirst | string | No | |
keyLength | integer | No | |
keySet | string | No | |
loadLength | integer | No | |
location | location | No | |
location2 | location | No | |
makeFileHash | hashtable | No | |
MapName | string | No | |
messageToTargetHash | hashtable | No | |
normalToAlphaHash | hashtable | No | |
playerColor | string | Yes | |
printCodeHash | hashtable | No | |
real | real | No | |
regionHash | hashtable | No | |
regionI | integer | No | |
regionTimerHash | hashtable | No | |
regionU | unit | Yes | |
reviveTimer | timer | Yes | |
reviveTimerdialog | timerdialog | Yes | |
saveData | integer | Yes | |
saveDataBagCharge1 | integer | No | |
saveDataBagCharge2 | integer | No | |
saveDataBagCharge3 | integer | No | |
saveDataBagCharge4 | integer | No | |
saveDataBagCharge5 | integer | No | |
saveDataBagCharge6 | integer | No | |
saveDataBagItem1 | integer | No | |
saveDataBagItem2 | integer | No | |
saveDataBagItem3 | integer | No | |
saveDataBagItem4 | integer | No | |
saveDataBagItem5 | integer | No | |
saveDataBagItem6 | integer | No | |
saveDataEncryption | integer | No | |
saveDataGold | integer | No | |
saveDataHeroAgi | integer | No | |
saveDataHeroCharge1 | integer | No | |
saveDataHeroCharge2 | integer | No | |
saveDataHeroCharge3 | integer | No | |
saveDataHeroCharge4 | integer | No | |
saveDataHeroCharge5 | integer | No | |
saveDataHeroCharge6 | integer | No | |
saveDataHeroExp | integer | No | |
saveDataHeroInt | integer | No | |
saveDataHeroItem1 | integer | No | |
saveDataHeroItem2 | integer | No | |
saveDataHeroItem3 | integer | No | |
saveDataHeroItem4 | integer | No | |
saveDataHeroItem5 | integer | No | |
saveDataHeroItem6 | integer | No | |
saveDataHeroStr | integer | No | |
saveDataHeroType | integer | No | |
saveDataLength1 | integer | No | |
saveDataLength10 | integer | No | |
saveDataLength11 | integer | No | |
saveDataLength12 | integer | No | |
saveDataLength13 | integer | No | |
saveDataLength14 | integer | No | |
saveDataLength15 | integer | No | |
saveDataLength16 | integer | No | |
saveDataLength17 | integer | No | |
saveDataLength18 | integer | No | |
saveDataLength19 | integer | No | |
saveDataLength2 | integer | No | |
saveDataLength20 | integer | No | |
saveDataLength21 | integer | No | |
saveDataLength22 | integer | No | |
saveDataLength23 | integer | No | |
saveDataLength24 | integer | No | |
saveDataLength3 | integer | No | |
saveDataLength4 | integer | No | |
saveDataLength5 | integer | No | |
saveDataLength6 | integer | No | |
saveDataLength7 | integer | No | |
saveDataLength8 | integer | No | |
saveDataLength9 | integer | No | |
saveDataLengthCheck | integer | No | |
saveDataLumber | integer | No | |
saveDataN | integer | No | |
saveDataSaveTick | integer | No | |
saveDataVersion | integer | No | |
saveHero | unitcode | Yes | |
saveHeroHash | hashtable | No | |
saveItem | itemcode | Yes | |
saveItemHash | hashtable | No | |
saveString | string | Yes | |
saveTick | integer | Yes | |
selectTimer | timer | Yes | |
selectUnitType | unitcode | Yes | UnitTypeNull |
smallAlphabetChar | string | No | |
specialChar | string | No | |
TestID | string | No | |
TestMode | boolean | No | |
ToolsAFKPrevent | boolean | No | |
ToolsCam | boolean | No | |
ToolsClean | boolean | No | |
ToolsDamagePrint | boolean | No | |
ToolsDice | boolean | No | |
ToolsFileSave | boolean | No | |
ToolsPatrol | boolean | No | |
ToolsSuicide | boolean | No | |
ToolsTeamKill | boolean | No | |
ToolsUnitBorrow | boolean | No |
//TESH.scrollpos=-1
//TESH.alwaysfold=0
function Trig_system_F9 takes nothing returns nothing
local quest qst
local string str
set qst=CreateQuest()
call QuestSetTitle(qst, "|c00DFFB4FGrabiti's RPG Creator 1.07|r")
set str="|cff47455A? |cffB4C3FFRPG name : |cffFFCD28" + udg_MapName
set str=str + "\n|cff47455A? |c00DFFB4F? The map is Grabiti's RPG Creator 1.07This is a map created based on."
set str=str + "\n|cff47455A? |cfffffc01Even when saving, the character is not deleted and the item is bound. Also, the save code is in the |cffFFCD28Warcraft folder.\\Grabiti's RPG Creator\\RPG name |cfffffc01It is recorded as a text file in the path."
set str=str + "\n|cff47455A? |cffB4C3FFThe number of item stacks is saved, and the backpack's inventory is also saved.."
set str=str + "\n|cff47455A? |cff78EFADFor further details |cff63CC63http://cafe.naver.com/rpgcreator |cff78EFADYou can check it at.|r"
call QuestSetDescription(qst, str)
call QuestSetIconPath(qst, "ReplaceableTextures\\CommandButtons\\BTNAmbush.blp")
call QuestSetRequired(qst, true)
set qst=CreateQuest()
call QuestSetTitle(qst, "|cff557DE1basic commands|r")
set str="|cffffcc00-eyesight <50~150> : |rAdjust the camera field of view."
set str=str + "\n|cffffcc00-Cam <50~150> : |rAdjust the camera field of view."
set str=str + "\n|cffffcc00-Suicide : |rkill your own hero."
set str=str + "\n|cffffcc00-Dice : |r1~100 Prints random numbers between."
set str=str + "\n|cffffcc00-Save : |rSave the hero."
set str=str + "\n|cffffcc00-Load : |rLoad the hero. (-Load After typing, you must continue entering the code..)"
call QuestSetDescription(qst, str)
call QuestSetIconPath(qst, "ReplaceableTextures\\CommandButtons\\BTNAmbush.blp")
call QuestSetRequired(qst, true)
set qst=null
endfunction
function InitTrig_system_F9 takes nothing returns nothing
endfunction
//TESH.scrollpos=-1
//TESH.alwaysfold=0
function Trig_CreepRegion_Timer takes nothing returns nothing
local timer t = GetExpiredTimer()
local integer unitType = LoadInteger(udg_regionTimerHash, GetHandleId(t), 0)
local integer unitCode = LoadInteger(udg_regionTimerHash, GetHandleId(t), 1)
local real x = LoadReal(udg_regionHash, 1, unitCode)
local real y = LoadReal(udg_regionHash, 2, unitCode)
local unit tempUnit
local integer timerLoop = 10
// Regenerate the unit after the regen waiting time.
set tempUnit = CreateUnit(Player(PLAYER_NEUTRAL_AGGRESSIVE), unitType, x, y, GetRandomReal(0, 360))
call AlphaToNormal(tempUnit, 0.02)
call SaveUnitHandle(udg_regionHash, 0, unitCode, tempUnit)
// Set empty space to secure the handle Id value.
call FlushChildHashtable(udg_regionTimerHash, GetHandleId(t))
call DestroyTimer(t)
set t = null
set tempUnit = null
endfunction
function Trig_CreepRegion_Actions takes nothing returns nothing
local timer t
local integer unitType = GetUnitTypeId(GetTriggerUnit())
local integer unitCode
local unit tempUnit
local integer loopA
// If the score of the dead hostile unit is not 100, wait for regeneration.
if (GetUnitPointValue(GetTriggerUnit()) != 100) then
set loopA = 1
loop
exitwhen loopA > udg_regionI
set tempUnit = LoadUnitHandle(udg_regionHash, 0, loopA)
if (GetTriggerUnit() == tempUnit) then
set unitCode = loopA
exitwhen true
endif
set loopA = loopA + 1
endloop
set t = CreateTimer()
call SaveInteger(udg_regionTimerHash, GetHandleId(t), 0, unitType)
call SaveInteger(udg_regionTimerHash, GetHandleId(t), 1, unitCode)
call TimerStart(t, I2R(GetUnitPointValueByType(GetUnitTypeId(GetTriggerUnit()))), false, function Trig_CreepRegion_Timer)
endif
// Set empty space to secure the handle Id value.
set t = null
set tempUnit = null
endfunction
//===========================================================================
function InitTrig_CreepRegion takes nothing returns nothing
set udg_regionTimerHash = InitHashtable()
set gg_trg_CreepRegion = CreateTrigger()
call TriggerRegisterPlayerUnitEvent(gg_trg_CreepRegion, Player(PLAYER_NEUTRAL_AGGRESSIVE), EVENT_PLAYER_UNIT_DEATH, null)
call TriggerAddAction(gg_trg_CreepRegion, function Trig_CreepRegion_Actions)
endfunction
//TESH.scrollpos=-1
//TESH.alwaysfold=0
function Trig_DamagePrint_Actions takes nothing returns nothing
if (udg_ToolsDamagePrint == true) and (GetEventDamage() > 0) then
if (GetPlayerController(GetOwningPlayer(GetTriggerUnit())) == MAP_CONTROL_USER) then
call MessageToTarget(GetTriggerUnit(), "|cfffffc01" + I2S(R2I(GetEventDamage())) + "|r", 0, 14.0, 90, 2.0, 60, 120, 7, 0.02, 255, 255, 255, true)
else
call MessageToTarget(GetTriggerUnit(), "|cffff0202" + I2S(R2I(GetEventDamage())) + "|r", 0, 14.0, 90, 2.0, 60, 120, 7, 0.02, 255, 255, 255, true)
endif
endif
endfunction
//===========================================================================
function InitTrig_DamagePrint takes nothing returns nothing
set gg_trg_DamagePrint = CreateTrigger()
set udg_damagePrintAction = TriggerAddAction(gg_trg_DamagePrint, function Trig_DamagePrint_Actions)
endfunction