Environment and special variables in MXM's ActionScript:All variables are basically strings. There are some operations which may treat them as numbers; those situations should be fairly evident from the parameters taken by those commands/functions.
Environment variables are basically replaced with the proper values when a name is encountered between two percent ('%') symbols. If the name is prefixed with an underscore ('_') it's a GLOBAL environment variable, and any changes will persist after the script has finished and accessable by other scripts that execute. LOCAL environment variables, on the other hand, exist only during the duration of a script, HOWEVER, so-called 'subscripts' executed using CALLSCRIPT or CALLSCRIPTFILE will inherit the parent script's local variables. Any changes the 'subscript' makes to these values is local only to THAT 'subscript' and its own called subscripts; when the 'subscript'exits, the local values of the parent script will be as they were before calling the 'subscript'. Subscripts requiring returned information will need to use GLOBAL environment space to do so.
Also note: GLOBAL variables are handy for skinners - they can be retrieved using the Gadget String source "env" along with the variable name as the key. In this way, ActionScripts can be used to update information on the screen within the skin!
Some commands require a <VarName> parameter - for these, you would use the name WITHOUT the percent signs - the idea is to pass the name in, and using it WITH percent signs means it would be evaluated into the VALUE, and pass THAT in, instead of the variable's name - the command would not know the proper place to assign the result to. If this seems confusing, I'm sorry... you'll just have to play around with the scripts and see the results; for advanced users, however, there are tricks you can apply, such as adding index values by tacking them into variable names:
CODE |
SET Index 1 SET Total 10 :TOPLOOP IF# %Index% > %Total% GOTO DONELOOP SET MyList%Index% "Some Value %Index% out of %Total%" ADD Index 1 GOTO TOPLOOP :DONELOOP
|
This would generate a set of variables, MyList1 ... MyList10, each containing a unique string.
One more note about Environment Variables: Keep the names alphanumeric. The names are case insensitive, but for clarity, you may prefer to with to maintain the case throughout your script.
Special variables are replaced with special characters, and if not matching one of the 'specials' ($eol$, $gt$, $lt$, $formatresult$, $timer$, $lasterror$, $dvd_mode$, or $tab$), it attempts to match it up with a "Gadget String" - those text sources used by MXM Skinners to display information on the screen. Thus, fetching $ip$ will return the current IP address of the Xbox, or $TempSysF$ will return the system temperature in degrees farenheit.
While these values may change, they cannot be assigned, nor can the ActionScript directly change them.
This post has been edited by BenJeremy: Oct 23 2003, 06:45 PM