//TESH.scrollpos=223
//TESH.alwaysfold=0
function CG_Init takes nothing returns nothing
set udg_Compress = SubString(udg_Alphabet, StringLength(udg_Alphabet)-1, 999)
set udg_Alphabet = SubString(udg_Alphabet, 0, StringLength(udg_Alphabet)-1)
endfunction
function CG_Encode takes integer i returns string
local integer b
local string s = ""
if i < udg_Base then
return SubString(udg_Alphabet, i, i + 1)
endif
loop
exitwhen i <= 0
set b = i - (i / udg_Base) * udg_Base
set s = SubString(udg_Alphabet, b, b + 1) + s
set i = i / udg_Base
endloop
return s
endfunction
function CG_SaveChar takes string c returns integer
local string low = "abcdefghijklmnopqrstuvwxyz"
local string high = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
local string int = "0123456789"
local integer i = S2I(c)
if i > 0 then
return i
endif
if c == "0" then
return 0
endif
set i = 0
loop
exitwhen i > 26
if SubString(low, i, i + 1) == c then
return i
elseif SubString(high, i, i + 1) == c then
return i
endif
set i = i + 1
endloop
return 0
endfunction
function CG_SaveString takes string name returns string
local integer i = 0
local integer a = StringLength(name)
local integer c = 0
loop
exitwhen i > a
set c = c + CG_SaveChar(SubString(name, i, i + 1))
set i = i + 1
endloop
return CG_Encode(c)
endfunction
function CG_StrPos takes string s returns integer
local integer i = 0
loop
exitwhen i > udg_Base
if s == SubString(udg_Alphabet, i, i + 1) then
return i
endif
set i = i + 1
endloop
return -1
endfunction
function CG_Decode takes string s returns integer
local integer a = 0
loop
exitwhen StringLength(s) == 1
set a = a * udg_Base + udg_Base * CG_StrPos(SubString(s, 0, 1))
set s = SubString(s, 1, 50)
endloop
return a+CG_StrPos(s)
endfunction
function CG_SaveBoolean takes boolean flag returns integer
if flag then
return 1
endif
return 0
endfunction
function CG_SaveHero takes unit it returns integer
local integer i = 1
loop
exitwhen i > udg_HeroCount
if udg_SaveHero[i] == GetUnitTypeId(it) then
return i
endif
set i = i + 1
endloop
return 0
endfunction
function CG_SaveItem takes item it returns integer
local integer i = 1
loop
exitwhen i > udg_ItemCount
if udg_SaveItem[i] == GetItemTypeId(it) then
return i
endif
set i = i + 1
endloop
return 0
endfunction
function CG_Seperate takes string s returns string
local integer i = 0
local integer b = StringLength(s)
local integer a = 0
loop
exitwhen i > b
if a == 4 then
set s = SubString(s, 0, i) + "-" + SubString(s, i, 999)
set a = 0
else
set a = a + 1
endif
set i = i + 1
endloop
return s
endfunction
function CG_Unseperate takes string s returns string
local integer i = 0
loop
exitwhen i > StringLength(s)
if SubString(s, i, i + 1) == "-" then
set s = SubString(s, 0, i) + SubString(s, i+1, 999)
endif
set i = i + 1
endloop
return s
endfunction
function CG_IsLower takes string s returns boolean
return s == "a" or s == "b" or s == "c" or s == "d" or s == "e" or s == "f" or s == "g" or s == "h" or s == "i" or s == "j" or s == "k" or s == "l" or s == "m" or s == "n" or s == "o" or s == "p" or s == "q" or s == "r" or s == "s" or s == "t" or s == "u" or s == "v" or s == "w" or s == "x" or s == "y" or s == "z"
endfunction
function CG_IsUpper takes string s returns boolean
return s == "W" or s == "A" or s == "B" or s == "C" or s == "D" or s == "E" or s == "F" or s == "G" or s == "H" or s == "I" or s == "J" or s == "K" or s == "L" or s == "M" or s == "N" or s == "O" or s == "P" or s == "Q" or s == "R" or s == "S" or s == "T" or s == "U" or s == "V" or s == "X" or s == "Y" or s == "Z"
endfunction
function CG_ColorChar takes string char returns string
local integer i = 0
local string s = udg_Alphabet + udg_Compress
loop
exitwhen i > udg_Base+1
if char == SubString(s, i, i + 1) then
if CG_IsLower(SubString(s, i, i + 1)) then
return udg_LOWER_CASE_COLOR + char + "|r"
elseif CG_IsUpper(SubString(s, i, i + 1)) then
return udg_UPPER_CASE_COLOR + char + "|r"
elseif SubString(s, i, i + 1) != "-" then
return udg_OTHER_CHARS_COLOR + char + "|r"
endif
endif
set i = i + 1
endloop
return char
endfunction
function CG_Color takes string s returns string
local integer i = 0
local string r = ""
loop
exitwhen i > StringLength(s)
set r = r + CG_ColorChar(SubString(s, i, i + 1))
set i = i + 1
endloop
return r
endfunction
function CG_ClearData takes nothing returns nothing
local integer i = 0
loop
exitwhen i > 50
set udg_Save[i] = 0
set i = i + 1
endloop
endfunction
function CG_SaveOnline takes nothing returns integer
if not ReloadGameCachesFromDisk() then
return 1
endif
return 0
endfunction
function CG_Execute takes nothing returns nothing
local integer i = 1
local integer t = 0
local string val = ""
set udg_Code = ""
loop
exitwhen i > udg_SaveCount
set val = CG_Encode(udg_Save[i])
set t = StringLength(val)
if t > 1 then
set udg_Code = udg_Code+udg_Compress+I2S(t)+val
else
set udg_Code = udg_Code+val
endif
set i = i + 1
endloop
if udg_SavePlayerName then
set udg_Code = udg_Code+CG_SaveString(GetPlayerName(GetTriggerPlayer()))
endif
set udg_Code = CG_SaveString(udg_Code)+udg_Code
set udg_Code = CG_Seperate(udg_Code)
set udg_Code = CG_Color(udg_Code)
endfunction
function CG_Load takes string str returns nothing
local integer i = 0
local integer b = StringLength(CG_Unseperate(str))
local integer key = 1
local integer c = 1
local string tmp = ""
set str = CG_Unseperate(str)
set udg_LOAD_VALID = true
set tmp = CG_SaveString(SubString(str, 2, b))
if SubString(str, 0, StringLength(tmp)) != tmp then
set udg_LOAD_VALID = false
return
endif
set str = SubString(str, StringLength(tmp), 999)
if udg_SavePlayerName then
set tmp = CG_SaveString(GetPlayerName(GetTriggerPlayer()))
if StringLength(tmp) > b then
set udg_LOAD_VALID = false
else
if SubString(str, b-StringLength(tmp), b) != tmp then
set udg_LOAD_VALID = false
endif
endif
set b = b-1
set str = SubString(str, 0, b)
endif
loop
exitwhen i >= b
if SubString(str, i, i + 1) == udg_Compress then
set key = S2I(SubString(str, i + 1, i + 2))
set i = i + (key)
endif
set udg_Load[c] = CG_Decode(SubString(str, i, i + key))
set c = c + 1
set i = i + key
set key = 1
endloop
call CG_ClearData()
endfunction
Name | Type | is_array | initial_value |
Actual_AOE | real | No | |
Actual_DmgAmount | real | No | |
Alphabet | string | No | |
Aqua_Burst_Ability_Level | integer | No | |
Aqua_Burst_Area_of_Effect | real | No | |
Aqua_Burst_Base_Damage | real | No | |
Aqua_Burst_Caster | unit | No | |
Aqua_Burst_Damage_Group | group | No | |
Aqua_Burst_Location | location | No | |
Aqua_Burst_Total_Damage | real | No | |
ArachnatidWarriorKills | integer | No | |
Arrow_Angle | real | No | |
Arrow_Caster | unit | Yes | |
Arrow_CasterLoc | location | No | |
Arrow_CountMaxSize | integer | No | |
Arrow_Counts | integer | No | |
Arrow_CusValue | integer | No | |
Arrow_Distance | real | Yes | |
Arrow_DistanceCount | real | Yes | |
Arrow_DistanceTravel | real | Yes | |
Arrow_DummyLoc | location | No | |
Arrow_Movement | location | No | |
Arrow_RandomUnit | group | No | |
Arrow_StartGroup | group | No | |
Arrow_StunDuration | integer | Yes | |
Arrow_TargetPoint | location | No | |
Arrow_UnitGroup | group | No | |
ARTargetPoint | location | Yes | |
AssasinDie | unit | Yes | |
Base | integer | No | |
Blacksmithplayer | player | No | |
Blood | effect | Yes | |
Bookdialog | dialog | No | |
Bookunit | unit | No | |
Cancelbook | button | No | |
caster | unit | No | |
ChargingThunderBall | boolean | Yes | |
chillingblastaoe | real | Yes | |
chillingblastdamage | real | Yes | |
chillingblastspeed | real | Yes | |
Code | StringExt | No | |
colorCode | string | Yes | |
Compress | string | No | |
CreepKill | integer | Yes | |
CreepKills | integer | Yes | |
DeathHero | integer | Yes | |
Earthbook | button | No | |
F_Integers | integer | Yes | |
F_ReachedFading | real | Yes | |
F_RFS_Caster | unit | Yes | |
F_RFS_MaxDamage | real | Yes | |
F_SetFadeValue | boolean | Yes | |
F_Time | real | Yes | |
F_Unit | unit | Yes | |
factions | string | Yes | |
Firebook | button | No | |
FW_Cast_Duration | integer | Yes | |
FW_Cast_Id | integer | No | |
FW_Cast_Level | integer | Yes | |
FW_Loop | integervar | No | |
FW_Loop_Number | integer | No | |
FW_Point | location | No | |
FW_Target_Location | location | Yes | |
FW_Ward_Group | group | Yes | |
glacialsurgeaoe | real | Yes | |
GlacialSurgeGroup | group | No | |
glacialsurgeintmultiplier | integer | Yes | |
glacialsurgespeed | real | Yes | |
GlacialSurgeTargetGroup | group | No | |
handle | integer | No | |
hashtable | hashtable | No | |
Hero | unit | No | |
HeroCount | integer | No | |
HeroKill | integer | Yes | |
HeroKills | integer | Yes | |
icetombdistance | real | Yes | |
icetombduration | real | Yes | |
ItemCount | integer | No | |
Lightningbook | button | No | |
Load | integer | Yes | |
LOAD_VALID | boolean | No | |
LoadCount | integer | No | |
LOWER_CASE_COLOR | string | No | |
ModeDialog | dialog | No | |
ModeDialogButton | button | No | |
ModeDialogButton2 | button | No | |
MoveFast | group | No | |
MoveSpeed | integer | Yes | 300 |
multiboard | multiboard | No | |
OTHER_CHARS_COLOR | string | No | |
PickGroup | group | No | |
PlayerName | string | Yes | |
point1 | location | No | |
point2 | location | No | |
point3 | location | No | |
Potionshopplayer | player | No | |
QuillboarKills | integer | No | |
RandomHero | unit | Yes | |
RangerDie | unit | Yes | |
Revive | timer | Yes | |
RF_AoE | real | No | |
RF_DamagePoint | location | No | |
RF_DamageTrees | boolean | No | |
RF_FallingTime | real | No | |
RF_MaxDamagePerRock | real | No | |
RF_MinDamagePerRock | real | No | |
RF_RockfallSequenceTimer | real | No | |
RF_RocksPerLevel | integer | No | |
RF_SineReals | real | Yes | |
RF_UnitGroup | group | No | |
RFA_Angle | real | Yes | |
RFA_Caster | unit | Yes | |
RFA_Distances | real | Yes | |
RFA_Group | group | No | |
RFA_HighSettings | real | Yes | |
RFA_Integers | integer | Yes | |
RFA_JumpHigh | real | Yes | |
RFA_MaxDmg | real | Yes | |
RFA_ReachedDistance | real | Yes | |
RFA_RealTimer | real | Yes | |
RFA_SpeedUnits | real | Yes | |
RFA_TempPoint | location | Yes | |
RFA_Unit | unit | Yes | |
RFAA_JumpHigh_Distance | real | No | |
RFAA_Speed | real | No | |
RFAA_TargetPoint | location | No | |
RFAA_Unit | unit | No | |
RFS_Caster | unit | Yes | |
RFS_Conjuring | boolean | Yes | |
RFS_ConjurPoint | location | No | |
RFS_DummyIntegers | integer | Yes | |
RFS_MaxDamage | real | Yes | |
RFS_NumberConjured | integer | Yes | |
RFS_NumberOfRocks | integer | Yes | |
RFS_Reals | real | Yes | |
RFS_TempPoint | location | Yes | |
RFS_Timer | real | Yes | |
RFSine_Caster | unit | Yes | |
RFSine_Integers | integer | Yes | |
RFSine_MaxDamage | real | Yes | |
RFSine_Unit | unit | Yes | |
RS_Duration | integer | No | |
RS_Hashtable | hashtable | No | |
RS_Key | integer | No | |
RS_Timer | timerdialog | No | |
RS_Unit | unit | No | |
Save | integer | Yes | |
SAVE_FAIL_REASON | string | No | |
SaveCount | integer | No | |
SaveHero | unitcode | Yes | |
SaveItem | itemcode | Yes | |
SavePlayerName | boolean | No | |
SF_ActualArea | real | No | |
SF_AreaBase | real | No | |
SF_AreaBonus | real | No | |
SF_Caster | unit | No | |
SF_CurrentHeight | real | No | |
SF_DamageBase | real | No | |
SF_DamageBonus | real | No | |
SF_DownHeight | real | No | |
SF_Hashtable | hashtable | No | |
SF_Height | real | No | |
SF_Integer | integer | No | |
SF_LoopGroup | group | No | |
SF_LVL | real | No | |
SF_Owner | player | No | |
SF_Point | location | No | |
SF_Point2 | location | No | |
SF_Real | real | No | |
SF_SpeedDown | real | No | |
SF_SpeedUp | real | No | |
sfx | effect | No | |
SH_Caster | unit | No | |
SH_Hashtable | hashtable | No | |
Sheild_How_Many | integer | No | |
SS | integervar | No | |
SS_Angle | real | Yes | |
SS_Angle_Speed_Rotation | real | Yes | |
SS_Countdown | integer | Yes | |
SS_Damage | real | Yes | |
SS_Distance | real | Yes | |
SS_Dummy | unit | Yes | |
SS_Formula | real | Yes | |
SS_Group | group | Yes | |
SS_Hero | unit | Yes | |
SS_Knockback_Off | boolean | Yes | |
SS_LEVEL | integer | No | |
SS_Number | real | Yes | |
SS_Point | location | Yes | |
SS_Rotate_Off | boolean | Yes | |
SS_Skip | integer | No | |
SS_Special | effect | Yes | |
SS_Speed | real | Yes | |
SS_Times | integer | No | |
SS_Unit | unit | Yes | |
target | unit | No | |
target2 | unit | No | |
TempInteger | integer | No | |
TempItem | item | No | |
TempLoc | location | No | |
temppoint1 | location | No | |
TempPoint1 | location | No | |
TempPoint2 | location | No | |
TempPoint3 | location | No | |
TempReal | real | No | |
TempUnit | unit | No | |
tempunit1 | unit | No | |
Termal_Eruption_Ability_Level | integer | No | |
Termal_Eruption_Area_of_Effect | real | No | |
Termal_Eruption_Base_Damage | real | No | |
Termal_Eruption_Caster | unit | No | |
Termal_Eruption_Damage_Group | group | No | |
Termal_Eruption_Dummy_Ability | abilcode | No | |
Termal_Eruption_DummyAbility2 | abilcode | No | |
Termal_Eruption_Location | location | No | |
Termal_Eruption_Loop_Location | location | No | |
Termal_Eruption_Loop_Number | integer | No | |
Termal_Eruption_Owner | player | No | |
Termal_Eruption_Total_Damage | real | No | |
ThunderBall | unit | Yes | |
ThunderBallGroup | group | No | |
UPPER_CASE_COLOR | string | No | |
Visibility | fogmodifier | Yes | |
VV_caster | unit | Yes | |
VV_counter | real | Yes | |
VV_finalRL | real | Yes | |
VV_finalRM | real | Yes | |
VV_index1 | integer | No | |
VV_index2 | integer | No | |
VV_index3 | integervar | No | |
VV_initialRL | real | Yes | |
VV_initialRM | real | Yes | |
VV_loop_boolean | boolean | Yes | |
VV_target | unit | Yes | |
Waterbook | button | No |