GlobalValueSet( <name>,
<value> )
Creates or changes a global value with the given <name>, that all
running scripts can access and that persists while Hamster is running.
Note: Names starting with "system" are reserved for future use and
can't be changed.
Returns: value.
GlobalValueSet( "State", "Transferring data" ) # transfer data GlobalValueSet( "State", "" )
GlobalValueGet( <name>,
<default> )
GlobalValueGet( <name> )
Returns the global value with the given <name>.
If no <default> is given and the global value does not exist yet, script
is stopped with an appropriate error message. If <default> is given and
the <name> does not exist yet, the value is created with the given
<default>.
Returns: value.
print( "Current state: ", GlobalValueGet("State","") )
GlobalValueAdd( <name>,
<number> )
Adds <number> to the global value with the given <name>.
If the value does not exist yet, it is automatically created with a value of 0.
Note: Names starting with "system" are reserved for future use and
can't be changed.
Returns: new value (Integer)
GlobalValueAdd( "MyCounter", 1 )
GlobalValueAppend(
<name>, <string> )
Appends <string> to the global value with the given <name>.
If the value does not exist yet, it is automatically created with an empty
string.
Note: Names starting with "system" are reserved for future use and
can't be changed.
Returns: new value (String)
GlobalValueAppend( "MyList", "listitem" + chr(13) + chr(10) )
GlobalValueWait( <name>,
<waitvalue> )
Pauses the script until the global value with the given <name> becomes <waitvalue>.
Returns: true/false
GlobalValueWait( "State", "" )
Enters or leaves a section of scriptcode with the given <name>.
No other running script can enter a section with the same <name> at the
same time. If another script already has entered such a section, the script will
be paused until the section is left again by the other script.
Note: Names starting with "system" are reserved for future use and
can't be used.
Returns: true/false.
GlobalEnter( "ExclusivePart" ) # (script code that may not run concurrently) GlobalLeave( "ExclusivePart" )