Are you talking about global variables (ex: globalvar=50,setvar=1"), or using variable system where you can use dimvar (ex: "dimvar=stamina,setvar=stamina 50").
Now I am still using v1.17 but have the variable system from the v1.18 source ported into our source. I can use both the "globalvar" and "dimvar", since "dimvar" did not exist in v1.17.
Here is an example script I use the "globalvar" command. It is taken from our WW2 game where I pick up a flashlight and two variables are called upon.
;Artificial Intelligence Script
;Header
desc = Level 1 Pickup Flashlight
;Triggers
:state=0:hudreset,hudx=86.2,hudy=21,hudimagefine=languagebank\english\gamecore\NorthernFox\WW2_GU\Huds\ww2_gu_l01_flashlight.png,hudname=l01_flashlight,hudhide=1,hudmake=display
:state=0:state=5
:state=5,plrdistwithin=50:hudshow=l01_flashlight,state=10
:state=10,scancodekeypressed=20:hudfadeout=l01_flashlight,fadehudright=l01_flashlight,playertake,coloff,activateifused=1,state=30
:state=10,plrdistfurther=60:hudfadeout=l01_flashlight,fadehudright=l01_flashlight,state=5
:state=30:state=31
:state=31:globalvar=2,incvar=1
:state=31:state=32
:state=32:globalvar=15,setvar=21
:state=32:state=33
:state=33:none
;End of Script
Notice the "state=31" line--> that "globalvar" I assigned to track how many inventory items I have collected. Variable #2 will increase by 1 and at the end of the level, my globalvar=2 value totals 6. When I go into my level 2, the global variable resets to zero, so I had to create a script to set my global variables to the values I wanted to "continue" on.
Now on the other side we have the "dimvar" command. Here is an example script from a demo I created that allows us to traverse levels, picking up inventory from one level and taking to any level.
;Artificial Intelligence Script
;Header
desc = Pickup Key
;Triggers
:state=0:hudreset,hudx=50,hudy=90,hudimagefine=gamecore\text\pickedupakey.tga,hudname=keyprompt,hudhide=1,hudmake=display,state=10
:state=10,plrdistwithin=40:state=1,playertake,coloff,plrsound=audiobank\misc\ping.wav,hudshow=keyprompt,hudfadeout=keyprompt
:state=1:dimvar=key,state=2
:state=2:setvar=key 1,state=3
:state=3:none
;End of Script
Now in this script I use the "dimvar" command to specify the variable to call upon, and set the value for that variable (state 1 and 2 lines). When I go to any other level, the value remains.
So in my two examples, here is what I can tell you:
* global variables reset at the start of each level
* variables using "dimvar" retain their values.
So depending on my development and whether I use global variables such as my first example or dimvar from my second, I also set a trigger to set the values to *where* they need to be for that development at that point.
**NOTE** This is based on taking the variable system from v1.18 source to add "dimvar and other variable commands" that v1.17 did not have originally.
Twitter: @NFoxMedia