xboxscene.org forums

Author Topic: Actionscript Reference  (Read 144 times)

psychogoblin

  • Archived User
  • Jr. Member
  • *
  • Posts: 70
Actionscript Reference
« on: February 11, 2005, 04:54:00 PM »

QUOTE
===================SPECIAL ACTIONSCRIPT SYMBOLS==================

$eol$
New line character
$lt$
?
$gt$
?


I believe that
$lt$ corresponds to the symbol for less than <

and

$gt$ corresponds to the symbol for greater than >

the code for html is &lt &gt, so if my speculation is correct, that's what those two tags are for. <
Logged

geniusalz

  • Archived User
  • Hero Member
  • *
  • Posts: 1635
Actionscript Reference
« Reply #1 on: November 08, 2003, 07:15:00 PM »

Here's a reference of current actionscript commands (compiled mostly from vexx22's and BJ's work)
If I have missed something, reply here


==============SYSTEM OPERATIONS===============
Reboot
Reboots your xbox
Shutdown
Shuts down the xbox
PowerCycle
Shuts down the xbox and then turn it on
ResetMenuCache
Resets the menu cache.  Do this after copying a new app/game to the hard disk
TrayOpen
Opens the DVD Tray
TrayClose
Closes the DVD Tray

LaunchDVD
Launches the DVD in Drive
SystemMenu <Activate|Hide|Unhide|ActivateFull>
EEPROMBackup [Filename]
Backs up EEPROM contents, encrypted, to a file, file defaults to "eeprom.bin" in current directory
EEPROMRestore [Filename]
Restores EEPROM contents, encrypted, from a file, file defaults to "eeprom.bin" in current directory
SETFANSPEED <Manual|Default> <speed>

DATE <Day> <Month> <Year>
Sets date
TIME <00:00>
Sets time

==============DRIVE OPERATIONS==============

ALLOWFORMAT <1|0>
Allows format through scripts and FTP SITE commands
Format <Drive>
Formats the drive
MOUNT <Drive:> [<DevicePartitionPath>]


==============FILE/FOLDER OPERATIONS===============
Attr <FileOrDir> ro|rw
Sets file attributes
Chmod 777 <FileOrDir>  
This command is compatible with FlashFXP's "Attributes" action
MkDir <PATH>
MAkes a directory
RmDir <PATH> <CASCADE>
Removes a directory
CD <PATH>
GUI only, sets default directory, which starts as MXM's path
Copy <Path/File/Wildcard> <Path/File>
When specifying Paths:
Copies everything from one path to another
When specifying File:
Copies the specified file to the other specified filename
Wildcard example:
COPY Z:\*.bmp E:\
Rename <FileOrPath> <FileOrPath>
Renames the file or directory
Delete <File>
Deletes the file

MEDIAPATCH <FilePath>
Experimental, patches media flag and media check code
EXEC <xbe> [<args>]
Executes xbe

==============VARIABLES===============
Use alphanumeric characters, prefix with underscore for "persistant a.k.a global" variables, that is, variables prefixed with an underscore ("_") will retain their value after the script is done running, and may be examined by other scripts. Variables are used in arguments as follows:

 SET SomeVar "This is a test"
 MessageBox %SomeVar%

 Will output a message box that says "This is a test"

Likewise, you can access system strings, just as in layouts, but use the string name bounded by "$" characters:

 SET SomeVar "The Time Is: $time$"
 MessageBox %SomeVar%

 Will output a message box that says something like "The Time Is 11:39pm"

 $eol$ is a special variable that inserts the CR/LF sequence into a string.... useful for message box text.

Important note on arguments for actions... if it's quoted, then the BACKSLASH is an escape character, meaning you'll need to
"double up" to see a single BACKSLASH in any quoted arguments. This is not an issue on arguments that are NOT quoted. You only
need to quote arguments that contain spaces.

Set <VarName> <Value>

SETFUNC <VarName> <Function> <Function Arguments>
Functions:
XBETITLE <FileName>
Returns the XBE Title (game name)
XBEID <FileName>
Returns the XBE ID: unique (usually) number for each xbe
FILESIZE <FileOrPath>
Returns the size of the file or folder
FILEEXIST <FileOrPath>
Returns whether the specified file or folder exists - (Returns 1 or 0)?
PATHEMPTY <Path>
Returns whether the directory is empty
LEFT <Count> <Text>
Returns the first <Count> characters from the left of the string
RIGHT <Count> <Text>
Similar to LEFT
MID <Count> <Length> <Text>
Returns <Length> characters, starting from <Count>
SPACE <Count>
Returns a string with <Count> spaces (?)
REPEAT <Count> <Text>
LENGTH <Text>
Returns the length of the string
TRIM <Text>
Returns after removing leading and trailing spaces (whitespace)
TRIMLEFT <Text>
Same as TRIM but from the left only
TRIMRIGHT <Text>
Same as TRIM but from the right only
LOWER <Text>
Returns the specified string, converted to lower case
UPPER <Text>
Returns the specified string, converted to upper case
CONDITION or COND <conditional>
Sets value to 1 or 0, depending on state of skin conditional
!CONDITION or !COND <conditional>
FNBASENAME <FilePath>
FNEXTENSION <FilePath>
FNPATH <FilePath>
FNMERGE <Path> <Filename> [<Extension>]
FATXIFY <filename> [<replacementchar>]
Do not use with a full path! backslashes and colons will be removed!!
TEMPFILE <Path> <Prefix> (Creates a new temporary filename)
REPLACE <Old> <New> <Source>
Returns a string with all instances of <Old> replaced with <New>
ContextScriptExists ScriptExists
Example:
SET someString "   test "
SETFUNC otherString UPPER %someString%
SETFUNC anotherString TRIM %otherString%

Callscript _Messagebox %otherString% (will show "   TEST ")
Callscript _Messagebox %anotherString% (will show "TEST")


==============ARITHMETIC OPERATIONS===============
ADD <VarName> <Value>
Numerically adds value to variable's value
SUB <VarName> <Value>
Numerically subtracts value from variable's value
DIV <VarName> <Value>
Numerically divides the variable's value by value
MULT <VarName> <Value>
Numerically multiplies the variable's value by value

==============SCRIPTING COMMANDS===============
:<Label>
Goto <Label>
Quit

IF <arg1> <op> <arg2> GOTO <label>   (Evaluates by comparing strings)
    <op>:
     =
     >
     <
     >=
     <=
     != or <>
     ##   (True if LValue contains RValue)
     #^   (Same as ##, but case insensitive)
     !##   (True if LValue doesn't contain RValue)
     !#^   (Same as !##, but case insensitive)
IF#
Used to evaluate numerically; used same as normal IF.
Note: Currently doesn't properly compare values larger than around 2 billion.
CallFile <file> <Args...>
Runs actionscript from the specified file
CallScript <name> <Args...>
Used to call internal scripts (check internal scripts section)

DELAY <Delay Sec>
Waits specified number of seconds
DELAYMS <Delay ms>
Waits specified number of miliseconds

==============GETTING INPUT===============
INPUT
Sets an input variable equal to 1 "e.g. pressing the B button will set the value of _GP_B equal to 1"
INPUT NOWAIT
Optional "nowait" parameter, which prevents it from waiting for input

Input variables:
_GP_A
_GP_B
_GP_X
_GP_Y
_GP_BLACK
_GP_WHITE
_GP_START
_GP_BACK
_GP_D_UP
_GP_D_DN
_GP_D_RT
_GP_D_LF
_GP_TRG_RT
_GP_TRG_LT
_GP_THUMB_LF
_GP_THUMB_RT


==============DRAWING ON THE SCREEN===============
BeginDraw [UseCurrent]

MessageBox <message>
Displays a message box AFTER script is done executing
Box <X> <Y> <Width> <Height> [<Color>] [<BorderColor>]
Draws a box on the screen
Text <X> <YTOP> <CENTER|LEFT|RIGHT> <Text> [<Color>]
Writes text on the screen

EndDraw


=================COLOR NAMES=====================
WHITE
BLACK
GRAY
BLUE
RED
GREEN
YELLOW
CYAN
VIOLET
ORANGE
BROWN

You may also add "LIGHT" or "DARK" as a prefix, names are not
case sensitive:

LightGreen is the same as LIGHTGREEN

It also accepts hexadecimal ARGB "Quads" such as 0xFF112233
See the Skinning Overview for details.


===================SPECIAL ACTIONSCRIPT SYMBOLS==================

$eol$
New line character
$lt$
?
$gt$
?


=================XML COMMANDS=====================
XMLOpen <HandleName> <FileName>
Opens an XML file or internal XML link (::MXM, ::PREFS, ::MENUCACHE, ::MENU, ::Internal)
XMLSave <HandleName> [<FileName>]
Saves XML back out to a given file
XMLSaveNode <HandleName> <FileName>
Save current selected node to file (File must not exist)
XMLSetNodePtr <HandleName> <Node> [OnFail <Label>]
Set the current node pointer
To start from "root" use ! Example: !.FTPServer.User:1 (Accesses second user node in FTPServer node of a config file)
XMLCreateNode <HandleName> <Node> [OnFail <Label>]
XMLCreateElement <HandleName> <Element> [OnFail <Label>]
XMLSetElementPtr <HandleName> <Element> [OnFail <Label>]
Must be relative to currently set node, or this will also cause the current node to change
XMLSetElementValue <HandleName> <Value>
XMLSetElementAttr <HandleValue> <Attribute> <Value>
XMLSetNodeAttr <HandleValue> <Attribute> <Value>
XMLSetValue <HandleValue> <Location> <Value> [<AttrPref>]
XMLGetValue <HandleValue> <VarName> <Location> [<DefaultValue>]
XMLGetNodeCount <HandleName> <VarName> [<Name>]
XMLGetElementCount <HandleName> <VarName> [<Name>]
XMLGetNodeAttrCount <HandleName> <VarName>
XMLGetElementAttrCount <HandleName> <VarName>
XMLCreate <HandleName> <MainNodeName>
XMLClose <HandleName>

Example:
XMLOPEN TestXML ::MXM
XMLSetNodePtr TestXML !.FTPServer.User
XMLGetNodePtr TestXML XMLPtr
XMLGetValue TestXML User1Name !.FTPServer.User:0.Name
XMLGetValue TestXML User2Name !.FTPServer.User:1.Name
XMLGetValue TestXML User1Pass !.FTPServer.User:0.Password
XMLGetValue TestXML User2Pass !.FTPServer.User:1.Password
CallScript _DisplayMessageBox "XMLNode Pointer=(%XMLPtr%)$eol$1)%User1Name% / %User1Pass%$eol$2)%User2Name% / %User2Pass%"
XMLSetNodePtr TestXML !.FTPServer
XMLGetNodeCount TestXML NewUser
XMLCreateNode TestXML User
XMLSetValue TestXML !.FTPServer.User:%NewUser%.Name Action
XMLSetValue TestXML !.FTPServer.User:%NewUser%.Password Script
XMLSave TestXML Z:Check.xml
XMLCLOSE TestXML

=====================INTERNAL XML LINKS=====================
::MXM
::Prefs
::BIOSMD5
::Menu
::Menu_Cache


=================FILE/FOLDER SEARCHING=====================
BEGINSEARCH <WildCardPath>
The local variables "search_name", "search_path", "search_arg", "search_size", "search_type", "search_active" (which equals "1" when the search values are OK) are updated during the search
SEARCHITEM <VarName>
Load VarName with current file/pathname
SEARCHSIZE <VarName>
Load VarName with current file size
SEARCHTYPE <VarName>
Load VarName with current type for entry - "file" or "dir"
SEARCHNEXT
ENDSEARCH


=================FILE READ/WRITE ACCESS=====================
OPENREAD <HandleName> <FilePath>
Opens the specified file for input
OPENWRITE <HandleName> <FilePath>
Opens the specified file for output
READFILELN <HandleName> <VarName>
Reads line and loads variable
WRITEFILELN <HandleName> <Text>
Writes line with text and appends CR/LF
WRITEFILE <HandleName> <Text>
Writes line with text
CLOSEFILE <HandleName>

FILESTAT <HandleName> <VarName>
If file access is OK, value will be "1" - for read, "0" means end - otherwise ""

WEBFILEFETCH <Filename> <URL>
A little goodie... but this is a very basic HTTP client, so it won't work with all sites


==============INTERNAL SCRIPTS===================
This is a copy of the Internal XML node used to
hold Internal ActionScripts

<ActionScript Name="_DisplayMessageBox">
BeginDraw UseCurrent
MessageBox %1%
EndDraw
Input
</ActionScript>
<ActionScript Name="_AutoExec">
IF $MXMVersion$ !#^ "WIP" GOTO DONE
CallScript _DisplayMessageBox "This is a WIP Release$eol$Do not distribute"
:DONE
</ActionScript>
</Scripts>

Example:
CallScript _DisplayMessageBox "Test"

To redefine internal scripts:

Example:
In your mxm.xml

<Config>
.
.
.
<ActionScript Name="_AutoExec">
CallScript _DisplayMessageBox "This is an alternate startup (Autoexec) script"
</ActionScript>
</Scripts>
.
.
.
</Config>

This post has been edited by geniusalz: Dec 2 2003, 01:41 AM
Logged