• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[JASS] game cache not working!

Status
Not open for further replies.
Level 8
Joined
Aug 4, 2006
Messages
357
hey i tried to use the "local handle vars" system to store and load local variables through a game cache. when it wasn't working properly, i did some debugging and found that either my StoreInteger(...) or GetStoredInteger(...) native functions are not doing anything. the same holds for storing other variable types. i can't even find any "game cache - load ..." functions in GUI in my world editor (v1.23 (6058) ).

is there any way to fix my world editor game cache functions so they will save/load properly?

here's my debugging code so you can check if i did something wrong:
JASS:
set udg_localVars = InitGameCache("jasslocalvars.w3v")
set i = 24
call BJDebugMsg("i0: "+I2S(i))
call StoreInteger(udg_localVars, "test", "asdf", i)
set i = GetStoredInteger(udg_localVars, "test", "asdf")
call BJDebugMsg("i1: "+I2S(i))
and the output was:
"i0: 24"
"i1: 0"
i0 should equal i1, but it doesn't. :sad:
 
Level 21
Joined
Aug 21, 2005
Messages
3,699
The jass looks correct, so I must be missing something. Try to see if HaveStoredInteger(udg_localVars, "test", "asdf") returns true?

The GUI load functions can be accessed through certain actions using functions. For example the "Set Variable" function can load a game cache variable, such as:
  • Set IntVar = Load asdf of test from udg_localVars
 
Level 8
Joined
Aug 4, 2006
Messages
357
i tested all of the game cache storing functions, and none of them are storing properly. i used HaveStoredInteger(...), HaveStoredReal(...), HaveStoredBoolean(...), etc. and all of them returned false after i stored stuff.

does anyone have an idea what i might have done wrong?

here you can check my code...
JASS:
function gameCacheTest takes nothing returns nothing
    local integer a = 56
    local real b = 27.89
    local boolean c = true
    local string d = "Your mom is fat"

    call BJDebugMsg("a0: "+I2S(a))
    call StoreInteger(udg_localVars, "test", "a", a)
    call BJDebugMsg("stored?: "+B2S(HaveStoredInteger(udg_localVars, "test", "a")))
    set a = GetStoredInteger(udg_localVars, "test", "a")
    call BJDebugMsg("a1: "+I2S(a))

    call BJDebugMsg("b0: "+R2S(b))
    call StoreReal(udg_localVars, "test", "b", b)
    call BJDebugMsg("stored?: "+B2S(HaveStoredReal(udg_localVars, "test", "b")))
    set b = GetStoredReal(udg_localVars, "test", "b")
    call BJDebugMsg("b1: "+R2S(b))

    call BJDebugMsg("c0: "+B2S(c))
    call StoreBoolean(udg_localVars, "test", "c", c)
    call BJDebugMsg("stored?: "+B2S(HaveStoredBoolean(udg_localVars, "test", "c")))
    set c = GetStoredBoolean(udg_localVars, "test", "c")
    call BJDebugMsg("c1: "+B2S(c))

    call BJDebugMsg("d0: "+d)
    call StoreString(udg_localVars, "test", "d", d)
    call BJDebugMsg("stored?: "+B2S(HaveStoredString(udg_localVars, "test", "d")))
    set d = GetStoredString(udg_localVars, "test", "d")
    call BJDebugMsg("d1: "+d)
endfunction
Note: B2S() is a custom function i made. its use is self-explanatory...

output:
JASS:
a0: 56
stored?: false
a1: 0
b0: 27.890
stored?: false
b1: 0.000
c0: true
stored?: false
c1: false
d0: "Your mom is fat"
stored?: false
d1:
 
Level 8
Joined
Aug 4, 2006
Messages
357
idk. did i? (no sarcasm intended)
JASS:
set udg_localVars = InitGameCache("jasslocalvars.w3v")
this is in the initialization trigger actions, which i am sure are running.

Edit: Deaod your question made me notice something. the line after i initialized udg_localVars, i called FlushGameCache... when i removed this, the game cache worked!! since you indirectly helped me solve my problem, i shall give you a rep :D
 
Status
Not open for further replies.
Top