Tintin Saving Variables

When you start up Tintin++, it does not automatically save any information from the last time you were running it. Here is a simple way of storing variables automatically so that they are available another time.

For 3k, create a file "3k_Variables.tin" which contains the following:

#CLASS {cGlobalVars} OPEN

#VARIABLE {my} {}
#VARIABLE {global} {}
#VARIABLE {static} {}

#ACTION {^Character saved.} {#class {cGlobalVars} {write} {${session[name]}_Variables.tin};} {1}

#CLASS {cGlobalVars} CLOSE

Then within the script you load to start 3k, make sure you have:

#EVENT {SESSION CONNECTED}
{
  #VAR {session[name]} {%0};
};

BEFORE you create your 3k #SESSION and the line:

#READ ${session[name]}_Variables.tin;

after it.

Once the 3k_Variables.tin file has been loaded, it will save anything within the class "cGlobalVars" into itself every time the text "Character saved." appears from the mud (every time 3k does a save of your character object).

Any variable you want to retain, put it within the cGlobalVars class and it will shortly get saved into this file and loaded again next time you start up Tintin++

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License