Click Expression Reference

From Mario Fan Games Galaxy Wiki
Revision as of 04:48, 12 November 2008 by Xgoff (talk | contribs) (nitpicking)

The following is a list of the expressions that are used in the various Click programs.

Note: this list only includes expressions for the default system objects and the Expression Editor dialog; extensions' expressions are not listed here. Some of these expressions may only be available in newer builds of specified programs. Expression names are not case-sensitive. Expressions including a $ return strings, and those without generally return numbers (but there is an exception in this list [and within some other extensions] which returns a string: key( "Player" ))

Special Object

Expression
Description
Availability
Random( int ) Generates a random integer from 0 to (n - 1). Max n is 65535. (put icons here someday)
[Name of Global Value] Returns the value of a given Global Value. TGF.gif MMF.gif TGF2.gif MMF2.gif
[Name of Global String] Returns the text of a given Global String. TGF.gif MMF.gif TGF2.gif MMF2.gif
Appdrive$ Returns the drive letter the application is found on. TGF.gif MMF.gif TGF2.gif MMF2.gif
Appdir$ Returns thee path where the application can be found, minus the drive letter. TGF.gif MMF.gif TGF2.gif MMF2.gif
Apppath$ Same as Appdrive$ + Appdir$. TGF.gif MMF.gif TGF2.gif MMF2.gif
AppTempPath$ Returns the path of the temporary folder where the application is extracted during runtime. TGF.gif MMF.gif TGF2.gif MMF2.gif
Appname$ Returns the name of the executable, minus ".exe". TGF.gif MMF.gif TGF2.gif MMF2.gif
BinFileTempName$( path ) Returns the name of the last extracted binary file. TGF.gif MMF.gif TGF2.gif MMF2.gif
Str$( number ) Converts a number into a string. TGF.gif MMF.gif TGF2.gif MMF2.gif
FloatToString$( float, total_digits, digits_after_point ) Converts a float into a string, with some formatting options. TGF.gif MMF.gif TGF2.gif MMF2.gif
Int( float ) Converts a float into an integer (anything after the decimal point is lost) TGF.gif MMF.gif TGF2.gif MMF2.gif
Round( float ) Rounds a float up if the decimal is >= .5, or down otherwise. The resulting number is still a float. TGF.gif MMF.gif TGF2.gif MMF2.gif
Hex$( integer ) Converts an integer to a hex string in the form 0xNNNNNNNN. The resulting hex string past the '0x' may be up to 8 characters, but can be less. TGF.gif MMF.gif TGF2.gif MMF2.gif
Bin$( integer ) Converts an integer to a binary string in the form 0bNNNNNNNN. The resulting binary string past the '0b' may be up to 32 characters, but can be less. TGF.gif MMF.gif TGF2.gif MMF2.gif
abs( number ) Returns the absolute value of a number (removes the negative sign in present). TGF.gif MMF.gif TGF2.gif MMF2.gif
ceil( float ) Forces a float to round to the nearest number larger than it. The result is still a float. (Ex: 3.2 -> 4.0; -3.2 -> -3.0) TGF.gif MMF.gif TGF2.gif MMF2.gif
ceil( float ) Forces a float to round to the nearest number smaller than it. The result is still a float. (Ex: 4.8 -> 4.0; -4.8 -> -5.0) TGF.gif MMF.gif TGF2.gif MMF2.gif
sqr( number ) Returns the square root of a number. TGF.gif MMF.gif TGF2.gif MMF2.gif
log( number ) Returns the base-10 log of a number. TGF.gif MMF.gif TGF2.gif MMF2.gif
ln( number ) Returns the natural log (base-e) of a number. TGF.gif MMF.gif TGF2.gif MMF2.gif
exp( number ) Returns e to the power of a number. TGF.gif MMF.gif TGF2.gif MMF2.gif
min( number1, number2 ) Returns the smaller of the two numbers. TGF.gif MMF.gif TGF2.gif MMF2.gif
max( number1, number2 ) Returns the larger of the two numbers. TGF.gif MMF.gif TGF2.gif MMF2.gif
sin( angle ) Returns the sine of the angle (in degrees). TGF.gif MMF.gif TGF2.gif MMF2.gif
cos( angle ) Returns the cosine of the angle (in degrees). TGF.gif MMF.gif TGF2.gif MMF2.gif
tan( angle ) Returns the tangent of the angle (in degrees). TGF.gif MMF.gif TGF2.gif MMF2.gif
asin( angle ) Returns the arcsine of the angle (in degrees). TGF.gif MMF.gif TGF2.gif MMF2.gif
acos( angle ) Returns the arccosine of the angle (in degrees). TGF.gif MMF.gif TGF2.gif MMF2.gif
atan( angle ) Returns the arctangent of the angle (in degrees). TGF.gif MMF.gif TGF2.gif MMF2.gif
atan2( y_delta, x_delta ) Returns the angle between two points (in degrees). TGF.gif MMF.gif TGF2.gif MMF2.gif
not( integer ) Performs and returns a bitwise Not on an integer. TGF.gif MMF.gif TGF2.gif MMF2.gif
left$( string, length ) Returns the left portion of string with a given length. TGF.gif MMF.gif TGF2.gif MMF2.gif
right$( string, length ) Returns the right portion of string with a given length. TGF.gif MMF.gif TGF2.gif MMF2.gif
mid$( string, start, length ) Returns the middle portion of string starting at a 0-based position and with a given length. TGF.gif MMF.gif TGF2.gif MMF2.gif
len( string ) Returns an integer representing the length of a string; the empty string "" is 0. TGF.gif MMF.gif TGF2.gif MMF2.gif
newline$ Causes following text to display on another line. TGF.gif MMF.gif TGF2.gif MMF2.gif
lower$( string ) Converts all characters in a string to lowercase. TGF.gif MMF.gif TGF2.gif MMF2.gif
upper$( string ) Converts all characters in a string to UPPERCASE. TGF.gif MMF.gif TGF2.gif MMF2.gif
find( string, pattern, startnum ) Returns an integer representing the 0-based location of the first character of the first occurence of pattern in string, starting at location startnum. If pattern is not found, -1 is returned. TGF.gif MMF.gif TGF2.gif MMF2.gif
reversefind( string, pattern, startnum ) Same as find(), but searches for pattern by starting at the end of string. TGF.gif MMF.gif TGF2.gif MMF2.gif
ndropped Returns the number of files dropped into application window. TGF.gif MMF.gif TGF2.gif MMF2.gif
dropped$( integer ) Returns the path of a dropped file, referenced by an integer. TGF.gif MMF.gif TGF2.gif MMF2.gif
commandline$( string ) Returns the command line used to launch the application. TGF.gif MMF.gif TGF2.gif MMF2.gif
getcommanditem$( string ) Returns the string from a provided command item switch. If the switch has no associated string, "Empty" is returned; if the switch is not found at all, "" is returned. TGF.gif MMF.gif TGF2.gif MMF2.gif
getrgb( red, green, blue ) Converts an RGB value to MMF's color format integer. Same as: red + green * 256 + blue * 65536 TGF.gif MMF.gif TGF2.gif MMF2.gif
getred( string ) Returns the red value from MMF's color format. TGF.gif MMF.gif TGF2.gif MMF2.gif
getgreen( string ) Returns the green value from MMF's color format. TGF.gif MMF.gif TGF2.gif MMF2.gif
getblue( string ) Returns the blue value from MMF's color format. TGF.gif MMF.gif TGF2.gif MMF2.gif
cliptext$ Returns the text currently in the clipboard. TGF.gif MMF.gif TGF2.gif MMF2.gif
loopindex( loopname ) Returns the current 0-based index of loopname. TGF.gif MMF.gif TGF2.gif MMF2.gif

Sound Object

Expression
Description
Availability
samplemainvolume Returns the value of the main volume setting. TGF.gif MMF.gif TGF2.gif MMF2.gif
samplevolume( sample ) Returns the volume of the specified sample. TGF.gif MMF.gif TGF2.gif MMF2.gif
channelvolume( channel ) Returns the volume of the specified channel (1 to 32). TGF.gif MMF.gif TGF2.gif MMF2.gif
samplemainpan Returns the current value of the main panning setting. TGF.gif MMF.gif TGF2.gif MMF2.gif
samplepan( sample ) Returns the pan of the specified sample. TGF.gif MMF.gif TGF2.gif MMF2.gif
channelpan( channel ) Returns the pan of the specified channel. TGF.gif MMF.gif TGF2.gif MMF2.gif
sampleposition( sample ) Returns the time position of the specified sample in milliseconds. TGF.gif MMF.gif TGF2.gif MMF2.gif
channelposition( channel ) Returns the time position of the specified sample in milliseconds. TGF.gif MMF.gif TGF2.gif MMF2.gif
sampleduration( sample ) Returns the total time of the specified sample, in milliseconds. TGF.gif MMF.gif TGF2.gif MMF2.gif
channelduration( channel ) Returns the total time of the specified channel, in milliseconds. TGF.gif MMF.gif TGF2.gif MMF2.gif
samplefreq( sample ) Returns the frequency in hertz of the specified sample, or 0 if there is no sample playing. TGF.gif MMF.gif TGF2.gif MMF2.gif
channelfreq( channel ) Returns the frequency in hertz of the specified channel, or 0 if the channel is not active. TGF.gif MMF.gif TGF2.gif MMF2.gif

Storyboard Controls Object

Expression
Description
Availability
frame Returns the current frame number. TGF.gif MMF.gif TGF2.gif MMF2.gif
players Returns the number of active players (using default movements). TGF.gif MMF.gif TGF2.gif MMF2.gif
frame width Returns the width of the frame in pixels. TGF.gif MMF.gif TGF2.gif MMF2.gif
frame height Returns the height of the frame in pixels. TGF.gif MMF.gif TGF2.gif MMF2.gif
virtualwidth Returns the frame's virtual width. TGF.gif MMF.gif TGF2.gif MMF2.gif
virtualheight Returns the frame's virtual height. TGF.gif MMF.gif TGF2.gif MMF2.gif
x left frame Returns the leftmost visible X coordinate of the frame. TGF.gif MMF.gif TGF2.gif MMF2.gif
x right frame Returns the rightmost visible X coordinate of the frame. TGF.gif MMF.gif TGF2.gif MMF2.gif
y top frame Returns the topmost visible Y coordinate of the frame. TGF.gif MMF.gif TGF2.gif MMF2.gif
y bottom frame Returns the bottommost visible Y coordinate of the frame. TGF.gif MMF.gif TGF2.gif MMF2.gif
framebkdcolor Returns the background color of the frame, in MMF's color format. TGF.gif MMF.gif TGF2.gif MMF2.gif
collisionmask( x, y ) Checks a point at x, y (on layer 1) to see what type of background collision it is; Returns 0 for nothing, 1 for obstacle, and 2 for ladder. TGF.gif MMF.gif TGF2.gif MMF2.gif
framerate Returns the current framerate. TGF.gif MMF.gif TGF2.gif MMF2.gif

Timer Object

Expression
Description
Availability
hours Returns the number of hours elapsed since the start of frame or the timer set to 0. TGF.gif MMF.gif TGF2.gif MMF2.gif
minutes Returns the number of minutes elapsed since the start of frame or the timer set to 0. TGF.gif MMF.gif TGF2.gif MMF2.gif
seconds Returns the number of seconds elapsed since the start of frame or the timer set to 0. TGF.gif MMF.gif TGF2.gif MMF2.gif
hundreds Returns the number of hundreths of a second elapsed since start of frame or the timer set to 0. TGF.gif MMF.gif TGF2.gif MMF2.gif
timer Returns the number of milliseconds elapsed since the start of frame or the timer set to 0. TGF.gif MMF.gif TGF2.gif MMF2.gif

Create Object

Expression
Description
Availability
total objects Returns the count of all objects on the frame. TGF.gif MMF.gif TGF2.gif MMF2.gif

Mouse and Keyboard Object

Expression
Description
Availability
xmouse Returns the X position of the mouse. TGF.gif MMF.gif TGF2.gif MMF2.gif
ymouse Returns the Y position of the mouse. TGF.gif MMF.gif TGF2.gif MMF2.gif
wheeldelta Returns the magnitude of the last mouse wheel movement; it should be a multiple of 120, but is device dependent. Positive if up, negative if down; must be reset manually. TGF.gif MMF.gif TGF2.gif MMF2.gif

Player Objects

Expression
Description
Availability
score( "Player X" ) Returns the score of player X (1 through 4). TGF.gif MMF.gif TGF2.gif MMF2.gif
lives( "Player X" ) Returns the number of lives of player X. TGF.gif MMF.gif TGF2.gif MMF2.gif
playername$( "Player X" ) Returns player X's name. TGF.gif MMF.gif TGF2.gif MMF2.gif
input( "Player X" ) Returns player X's input device. TGF.gif MMF.gif TGF2.gif MMF2.gif
key( "Player X", keynum) Returns a string representing the key assigned to keynum: 0 for up, 1 for down, 2 for left, 3 for right, 4 for fire1, 5 for fire2, 6 for fire3, and 7 for fire4. TGF.gif MMF.gif TGF2.gif MMF2.gif