- Joined
- Oct 12, 2004
- Messages
- 109
ok so i'm using katanna's LHV and i can't seem to create a global cache variable.. everytime i save my wc3edit crashes... This is what im doing and this is the code:
Code:
function Trig_test_Actions takes nothing returns nothing
call FlushGameCache(InitGameCache("cache.x"))
set udg_GameCache=InitGameCache("cache.x")
endfunction
//===========================================================================
function InitTrig_test takes nothing returns nothing
set gg_trg_test = CreateTrigger( )
call TriggerAddAction( gg_trg_test, function Trig_test_Actions )
endfunction
JASS:
//=========================================================================================
//Requires a global gamecache variable named udg_cache
//
//Handle Variables System by: kattana
//=========================================================================================
function H2I takes handle h returns integer
return h
return 0
endfunction
function Cache takes nothing returns gamecache
if udg_cache==null then
set udg_cache=InitGameCache("Cache")
endif
return udg_cache
endfunction
function SetHandleInt takes handle subject, string key, integer value returns nothing
call StoreInteger(Cache(),I2S(H2I(subject)),key,value)
endfunction
function SetHandleHandle takes handle subject, string key, handle value returns nothing
if value==null then
call FlushStoredInteger(Cache(),I2S(H2I(subject)),key)
else
call StoreInteger(Cache(),I2S(H2I(subject)),key,H2I(value))
endif
endfunction
function SetHandleReal takes handle subject, string key, real value returns nothing
if value==0 then
call FlushStoredReal(Cache(),I2S(H2I(subject)),key)
else
call StoreReal(Cache(),I2S(H2I(subject)),key,value)
endif
endfunction
function GetHandleHandle takes handle subject, string key returns handle
return GetStoredInteger(Cache(),I2S(H2I(subject)),key)
return null
endfunction
function GetHandleEffect takes handle subject, string key returns effect
return GetStoredInteger(Cache(),I2S(H2I(subject)),key)
return null
endfunction
function GetHandleUnit takes handle subject, string key returns unit
return GetStoredInteger(Cache(),I2S(H2I(subject)),key)
return null
endfunction
function GetHandleLightning takes handle subject, string key returns lightning
return GetStoredInteger(Cache(),I2S(H2I(subject)),key)
return null
endfunction
function GetHandleReal takes handle subject, string key returns real
return GetStoredReal(Cache(),I2S(H2I(subject)),key)
endfunction
function GetHandleInt takes handle subject, string key returns integer
return GetStoredInteger(Cache(),I2S(H2I(subject)),key)
endfunction
function FlushHandleLocals takes handle subject returns nothing
call FlushStoredMission(Cache(),I2S(H2I(subject)))
endfunction