TGE Script Commands

In this section I will explain each Console command and function used in the TGE CVS HEAD version as of 04/04/02. Examples of each command or function will be given, along with its prototype, and its return value. Before we begin, let’s take a few minutes to define some terms, reserved keywords and operators that will be used within this document.

Document Style

Document text Document text other than function prototypes and examples will be formated using a 12pt Arial font Function prototype Function prototypes will be BOLD formatted using a 12pt Verdana font Function example Function examples will be formatted using a 12pt Courier font

Terms used within the document

stringrefers to any single or double quoted collection of characters that can include both numbers and text
booleanrefers to a numeric value of either 1 or 0 (1 being TRUE and 0 being FALSE)
numericrefers to any intrinsic numeric data type (whole number, boolean, decimal number and or a hexadecimal number)
globalvariable refers to a variable that is accessible from within any function or script
local variablerefers to a variable that is only accessible within the function or script it is created
variablerefers to any string that begins with a percent sign (%) denoting a local variable or dollar sign ($) denoting a global variable
tagged stringTagged strings is used for any string constant that is transmitted across a connection. The entire tagged string is sent only once, when referenced a short tag (numeric value) identifying that string is sent instead of the entire string.

Reserved Key Words

break, case, continue, datablock, default, else, false, function, if, for, new, or, package, return, switch, switch$, true, and while

Operators


Assignment operators
=Assigns the value of the second operand to the first operand.

Mathematical Operators:
+(Addition) Adds 2 numbers
-(subtraction) Subtracts the value of its argument.
*(Multiplication) Multiplies 2 numbers.
/(Division) Divides 2 numbers.
%(Modulus) Computes the integer remainder of dividing 2 numbers.
+=Adds 2 numbers and assigns the result to the first.
-=Subtracts 2 numbers and assigns the result to the first.
*=Multiplies 2 numbers and assigns the result to the first.
/=Divides 2 numbers and assigns the result to the first.
%=Computes the modulus of 2 numbers and assigns the result to the first.
++(Increment) Adds one to a variable representing a number (returning either the new or old value of the variable)
--(Decrement) Subtracts one from a variable representing a number (returning either the new or old value of the variable)

Bitwise Operators:
~(Bitwise NOT) Flips the bits of its operand.
|(Bitwise OR) Returns a one in a bit if bits of either operand is one.
&(Bitwise AND) Returns a one in each bit position if bits of both operands are ones.
^(Bitwise XOR) Returns a one in a bit position if bits of one but not both operands are one.
<<(Left shift) Shifts its first operand in binary representation the number of bits to the left specified in the second operand, shifting in zeros from the right.
>>(Sign-propagating right shift) Shifts the first operand in binary representation the number of bits to the right specified in the second operand, discarding bits shifted off.
|=Performs a bitwise OR and assigns the result to the first operand.
&=Performs a bitwise AND and assigns the result to the first operand.
^=Performs a bitwise XOR and assigns the result to the first operand.
<<=Performs a left shift and assigns the result to the first operand.
>>=Performs a sign-propagating right shift and assigns the result to the first operand.

String operators::
@Concatenates one or more values together to form a new value
NLConcatenates one value together with a new line to form a new value
TABConcatenates one value together with a tab to form a new value
SPCConcatenates one value together with a space to form a new value

Logical Operators:
!evaluates the opposite of the value specified
&&requires both values to be true for the result to be true.
||requires only one value to be true for the result to be true.

Relational Operators:
==value1 and value2 are equal
!=value1 and value2 are not equal
<value1 is less than value2
>value1 is greater than value2
<=value1 is less than or equal to value2
>=value1 is greater than or equal to value2

String comparison Operators:
$=string1 is equal to string2
!$=string1 is not equal to string2

Index of console functions, alphabetical order:

AddCardProfile
ContainerBoxEmpty
ContainerRayCast
ContainerSearchCurrDist
ContainerSearchCurrRadiusDist
ContainerSearchNext
FreeMemoryDump
GLEnableLogging
GLEnableMetrics
GLEnableOutline
InitContainerRadiusSearch
MathInit
MatrixCreate
MatrixCreateFromEuler
MatrixMulPoint
MatrixMulVector
MatrixMultiply
OpenALInitDriver
OpenALRegisterExtensions
OpenALShutdownDriver
StripMLControlChars
ValidateMemory
VectorAdd
VectorCross
VectorDist
VectorDot
VectorLen
VectorNormalize
VectorOrthoBasis
VectorScale
VectorSub
activateDirectInput
activateKeyboard
activatePackage
addMaterialMapping
addOSCardProfile
addTaggedString
aiAddPlayer
aiConnect
alGetString
alListener3f
allowConnections
alxCreateSource
alxGetChannelVolume
alxGetListener3f
alxGetListenerf
alxGetListeneri
alxGetSource3f
alxGetSourcef
alxGetSourcei
alxIsPlaying
alxListener
alxPlay
alxSetChannelVolume
alxSource3f
alxSourcef
alxSourcei
alxStop
alxStopAll
backtrace
buildTaggedString
calcExplosionCoverage
call
cancel
cancelServerQuery
clearTextureHolds
collapseEscape
commandToClient
commandToServer
compile
connect
containerFindFirst
containerFindNext
createCanvas
dbgSetParameters
deactivateDirectInput
deactivateKeyboard
deactivatePackage
debug
debug_debugbreak
debug_testx86unixmutex
decreaseNPatch
deleteDataBlocks
deleteVariables
detag
disableMouse
dnetSetLogging
dumpConsoleClasses
dumpMemSnapshot
dumpNetStringTable
dumpResourceStats
dumpTextureStats
echo
echoInputState
enableMouse
enableWinConsole
error
exec expandEscape
expandFilename
export
fileBase
fileExt
fileName
filePath
findFirstFile
findNextFile
firstWord
flushTextureCache
getBoxCenter
getBuildString
getCompileTimeString
getControlObjectAltitude
getControlObjectSpeed
getDesktopResolution
getDisplayDeviceList
getField
getFieldCount
getFields
getFileCRC
getFileCount
getJoystickAxes
getMaxFrameAllocation
getModPaths
getRandom
getRandomSeed
getRealTime
getRecord
getRecordCount
getRecords
getResolution
getResolutionList
getServerCount
getSimTime
getSubStr
getTag
getTaggedString
getTerrainHeight
getVersionNumber
getVersionString
getVideoDriverInfo
getWord
getWordCount
getWords
gotoWebPage
increaseNPatch
inputLog
isDemoRecording
isDeviceFullScreenOnly
isEventPending
isFile
isFullScreen
isJoystickDetected
isKoreanBuild
isObject
isPackage
isPointInside
isWriteableFileName
launchDedicatedServer
lightScene
localConnect
lockMouse
ltrim
mAbs
mAcos
mAsin
mAtan
mCeil
mCos
mDegToRad
mFloatLength
mFloor
mLog
mPow
mRadToDeg
mSin
mSolveCubic
mSolveQuadratic
mSolveQuartic
mSqrt
mTan
makeTestTerrain
msg
nameToID
nextResolution
nextToken
panoramaScreenShot
pathOnMissionLoadDone
permDisableMouse
playDemo
playJournal
prevResolution
profilerDump
profilerDumpToFile
profilerEnable
profilerMarkerEnable
purgeResources
queryMasterServer
quit
rebuildModPaths
redbookClose
redbookGetDeviceCount
redbookGetDeviceName
redbookGetLastError
redbookGetTrackCount
redbookGetVolume
redbookOpen
redbookPlay
redbookSetVolume
redbookStop
removeField
removeRecord
removeTaggedString
removeWord
resetLighting
restWords
rtrim
saveJournal
schedule
screenShot
setDefaultFov
setDisplayDevice
setEchoFileLoads
setField
setFov
setInteriorFocusedDebug
setInteriorRenderMode
setLogMode
setModPaths
setNPatch
setNetPort
setOpenGLAnisotropy
setOpenGLInteriorMipReduction
setOpenGLMipReduction
setOpenGLSkyMipReduction
setOpenGLTextureCompressionHint
setPowerAudioProfiles
setRandomSeed
setRecord
setResolution
setRes
setScreenMode
setServerInfo
setShadowDetailLevel
setVerticalSync
setWord
setZoomSpeed
showDeleteThread
showNewThread
showPlay
showSelectSequence
showSequenceLoad
showSetCamera
showSetDetailSlider
showSetKeyboard
showSetLightDirection
showSetPos
showSetScale
showShapeLoad
showStop
showToggleRoot
showToggleStick
showTurnLeft
showTurnRight
showUpdateThreadControl
snapToggle
sripChars
startHeartbeat
startRecord
stopHeartbeat
stopRecord
stopServerQuery
strToPlayerName
strchr
strcmp
stricmp
stripTrailingSpaces
strlen
strlwr
strpos
strreplace
strstr
strupr
switchBitDepth
telnetSetParameters
toggleFullScreen
toggleInputState
toggleNPatch
trace
trim
videoSetGammaCorrection
warn

The following console commands and functions are listed in order as viewed in the output from ConsoleDoc:

OpenALInitDriver()

   	if(!OpenALInitDriver())
         		error("   Failed to initialize driver.");

OpenALShutdownDriver()

function OpenALShutdown()
{
	OpenALShutdownDriver()
}

OpenALRegisterExtensions()

	function OpenALRegister()
	{
		OpenALRegisterExtensions();
	}

alGetString(ALenum)

function OptAudioUpdate()
{
// set the driver text
%text =   "Vendor: " @ alGetString("AL_VENDOR") @
           		"\nVersion: " @ alGetString("AL_VERSION") @
           		"\nRenderer: " @ alGetString("AL_RENDERER") @
           		"\nExtensions: " @ alGetString("AL_EXTENSIONS");
  		 OptAudioInfo.setText(%text);
}

alxCreateSource( profile, {x,y,z} | description, filename, {x,y,z} )

function OptAudioUpdateMasterVolume(%volume)
{
if (%volume == $pref::Audio::masterVolume)
return;
alxListenerf(AL_GAIN_LINEAR, %volume)
$pref::Audio::masterVolume = %volume;
if (!alxIsPlaying($AudioTestHandle))
{
$AudioTestHandle = alxCreateSource("AudioChannel0", expandFilename("~/data/sound/testing.wav"));
      		alxPlay($AudioTestHandle);
}
}

alxSourcef( handle, ALenum, value)

            alxSourcef($ClientChatHandle[%sender], "AL_PITCH", %pitch);

alxSource3f(handle,ALenum,\"xyz\"|x,y,z)

	alxSourcef($ClientChatHandle[%sender], "AL_PITCH", %x, %y, %z);

alxSourcei(handle, ALenum, value)

            alxSourcei($ClientChatHandle[%sender], "AL_PITCH", %pitch);

alxGetSourcef(handle,Alenum)

	%pitch = alxGetSourcef(($ClientChatHandle[%sender], "AL_PITCH");

alxGetSource3f(handle, ALenum)

	%pitch = alxGetSourcef(($ClientChatHandle[%sender], "AL_PITCH");

alxGetSourcei(handle, ALenum)

	%pitch = alxGetSourcef(($ClientChatHandle[%sender], "AL_PITCH");

alxPlay(handle) | alxPlay(profile) | alxPlay(profile, x,y,z)

	function OptAudioUpdateChannelVolume(%channel, %volume)
{
if (%channel < 1 || %channel > 8)
	return;
            		if (%volume == $pref::Audio::channelVolume[%channel])
	      		return;
   		alxSetChannelVolume(%channel, %volume);
   		$pref::Audio::channelVolume[%channel] = %volume;
	   	if (!alxIsPlaying($AudioTestHandle))
   		{
$AudioTestHandle = alxCreateSource("AudioChannel"@%channel,    expandFilename("~/data/sound/testing.wav"));
      		alxPlay($AudioTestHandle);
   		}
	}

alxStop(handle)

         if ( $ClientChatHandle[%sender] != 0 )
            alxStop( $ClientChatHandle[%sender] );

alxStopAll()

	function clientCmdMissionEnd(%seq,%player)
	{
   		// Recieved when the current mission is ended.
   		alxStopAll();
		…
		…
	}

alxIsPlaying(handle)

   	if (!alxIsPlaying($AudioTestHandle))
   	{
$AudioTestHandle = alxCreateSource("AudioChannel0", expandFilename("~/data/sound/testing.wav"));
      	alxPlay($AudioTestHandle);
   	}

alxListener(ALenum,value)

function OpenALInit()
{
   OpenALShutdownDriver();

   echo("");
   echo("OpenAL Driver Init:");

   echo ($pref::Audio::driver);
   if($pref::Audio::driver $= "OpenAL")
      if(!OpenALInitDriver())
         error("   Failed to initialize driver.");

   echo("   Vendor: " @ alGetString("AL_VENDOR"));
   echo("   Version: " @ alGetString("AL_VERSION"));
   echo("   Renderer: " @ alGetString("AL_RENDERER"));
   echo("   Extensions: " @ alGetString("AL_EXTENSIONS"));

   alxListenerf( AL_GAIN_LINEAR, $pref::Audio::masterVolume );

   for (%channel=1; %channel <= 8; %channel++)
     alxSetChannelVolume(%channel, $pref::Audio::channelVolume[%channel]);

   echo("");
}

alListener3f(ALenum,\"xyz\"|x,y,z)

function OpenALInit()
{
   OpenALShutdownDriver();

   echo("");
   echo("OpenAL Driver Init:");

   echo ($pref::Audio::driver);
   if($pref::Audio::driver $= "OpenAL")
      if(!OpenALInitDriver())
         error("   Failed to initialize driver.");

   echo("   Vendor: " @ alGetString("AL_VENDOR"));
   echo("   Version: " @ alGetString("AL_VERSION"));
   echo("   Renderer: " @ alGetString("AL_RENDERER"));
   echo("   Extensions: " @ alGetString("AL_EXTENSIONS"));

   alxListener3f( AL_GAIN_LINEAR, $pref::Audio::masterVolume );

   for (%channel=1; %channel <= 8; %channel++)
     alxSetChannelVolume(%channel, $pref::Audio::channelVolume[%channel]);

   echo("");
}

alxGetListenerf(ALenum)

	%LinearGain = alxGetListenerf(AL_GAIN_LINEAR);

alxGetListener3f(ALenum)

	%LinearGain = alxGetListenerf(AL_GAIN_LINEAR);

alxGetListeneri(ALenum)

	%LinearGain = alxGetListenerf(AL_GAIN_LINEAR);

alxGetChannelVolume(channel_id)

	$pref::Audio::channelVolume[%channel] = alxGetChannelVolume(%channel);

alxSetChannelVolume(channel_id)

	alxSetChannelVolume(%channel, %volume);

dumpConsoleClasses()

dumpConsoleClasses()

expandFilename(filename)

$AudioTestHandle = alxCreateSource("AudioChannel0", expandFilename("~/data/sound/testing.wav"));

strcmp(one,two)

	if ( strcmp( %name, %rawName ) == 0 )
		return false;

stricmp(one,two)

	< 0 	"one" is less than "two".
	   0 	"one" is equal to "two".
	> 0	"one" is greater than "two"

	if ( stricmp( %name, %rawName ) == 0 )
		return false;

strlen(str)

	%StringLength = strlen(%player.ShapeName);

strstr(string,substr)

	%pos = strstr( %action, "pov" );

strpos(stringhay,stringneedle[,intoffset])

if (%hasNextArg && strpos(%nextArg, "-") == -1)
{
$showShapeList = $showShapeList @ " " @ %nextArg;
$argUsed[%i+1]++;
%i++;
}

ltrim(str)

	%trimed = ltrim(%value);

rtrim(str)

	%trimed = rtrim(%value);

trim(str)

	%trimed = trim(%value");

sripChars(string,chars)

	%striped = stripChars(%value, "~" );

strlwr(string)

	%var = strlwr(%value);

strupr(string)

	%var = strupr(%value);

strchr(string,char)

	%var = strchr(%vale, "~" );

strreplace(string,from,to)

%var = strreplace(%value, "~", "-");

getSubStr(string,start,numChars)

	function serverCmdTeamMessageSent(%client, %text)
	{
   		if(strlen(%text) >= $Pref::Server::MaxChatLen)
      		%text = getSubStr(%text, 0, $Pref::Server::MaxChatLen);
		chatMessageTeam(%client, %client.team, '\c3%1: %2', %client.name, %text);
	}

getWord(text,index)

	function TerrainEditor::offsetBrush(%this, %x, %y)
	{
   		%curPos = %this.getBrushPos();
   		%this.setBrushPos(getWord(%curPos, 0) + %x, getWord(%curPos, 1) + %y);
	}

getWords(text,index [,entindex])

	%pos    = getWords(%obj.getTransform(), 0, 2);

setWord(text,index,replace)

	function WorldEditor::dropCameraToSelection(%this)
	{
   		if(%this.getSelectionSize() == 0)
      			return;

   		%pos = %this.getSelectionCentroid();
   		%cam = LocalClientConnection.camera.getTransform();

   		// set the pnt
   		%cam = setWord(%cam, 0, getWord(%pos, 0));
   		%cam = setWord(%cam, 1, getWord(%pos, 1));
   		%cam = setWord(%cam, 2, getWord(%pos, 2));

   		LocalClientConnection.camera.setTransform(%cam);
	}

removeWord(text,index)

	%cam = removeWord(%cam, 0, getWord(%pos, 0));

getWordCount(text)

         if ( %pos != -1 )
         {
            %wordCount = getWordCount( %action );
            %mods = %wordCount > 1 ? getWords( %action, 0, %wordCount - 2 ) @ " " : "";
            %object = getWord( %action, %wordCount - 1 );
            switch$ ( %object )
            {
               case "upov":   %object = "POV1 up";
               case "dpov":   %object = "POV1 down";
               case "lpov":   %object = "POV1 left";
               case "rpov":   %object = "POV1 right";
               case "upov2":  %object = "POV2 up";
               case "dpov2":  %object = "POV2 down";
               case "lpov2":  %object = "POV2 left";
               case "rpov2":  %object = "POV2 right";
               default:       %object = "??";
            }
            return( %mods @ %object );
         }
         else
            error( "Unsupported Joystick input object passed to getDisplayMapName!" );
      }

getField(text,index)

	function SM_StartMission()
	{
   		%id = SM_missionList.getSelectedId();
   		%mission = getField(SM_missionList.getRowTextById(%id), 1);

   		if ($pref::HostMultiPlayer)
      			%serverType = "MultiPlayer";
   		else
      			%serverType = "SinglePlayer";

   		createServer(%serverType, %mission);
   		localConnect($pref::Player::Name);
	}

getFields(text,index [,entindex])

	%fields = getFields((SM_missionList.getRowTextById(%id), 1, 3 );

setField(text,index,replace)

	function PlayerListGui::updateScore(%this,%clientId,%score)
	{
   		%text = PlayerListGuiList.getRowTextById(%clientId);
   		%text = setField(%text,1,%score);
   		PlayerListGuiList.setRowById(%clientId, %text);
   		PlayerListGuiList.sortNumerical(1);
	}

removeField(text,index)

	function removeFromServerGuidList( %guid )
	{
   		%count = getFieldCount( $Server::GuidList );
   		for ( %i = 0; %i < %count; %i++ )
   		{
      			if ( getField( $Server::GuidList, %i ) == %guid )
      			{
         				$Server::GuidList = removeField( $Server::GuidList, %i );
        				return;
      			}
   		}

  	 // Huh, didnt find it.
	}

getFieldCount(text)

	%count = getFieldCount($Server::GuidList);

getRecord(text,index)

	function Texture::saveMaterial()
	{
   		%id = $selectedMaterial;
   		if (%id == -1)
      			return;

   		Texture::SaveOperation();
   		%data = Texture_Material.getRowTextById(%id);
   		%newData = getRecord(%data,0);

   		%rowCount = Texture_Operation.rowCount();
   		for (%row=0; %row<%rowCount; %row++)
      			%newdata = %newdata @ "\n" @ Texture_Operation.getRowText(%row);

   		Texture_Material.setRowById(%id, %newdata);
   		Texture::save();
	}

getRecords(text,index[,endIndex])

	%data = Texture_Material.getRowTextById(%id);
   	%records = getRecords(%data,1,3);

setRecord(text,index,replace)

	%data = Texture_Material.getRowTextById(%id);
	%replaced = setRecord(%data,3,"foo");

removeRecord(text,index)

	%data = Texture_Material.getRowTextById(%id);
	%replaced = removeRecord(%data,3);

getRecordCount(text)

   	%data = Texture_material.getRowTextById(%id);
	Texture_operation.clear();
   	%recordCount = getRecordCount(%data);

firstWord(text)

   	// a target in range was found so select it
   	if (%scanTarg)
   	{
      		%targetObject = firstWord(%scanTarg);
      		%client.setSelectedObj(%targetObject);
   	}

restWords(text)

	function Heightfield::showTab(%id)
	{
   		Heightfield::hideTab();
   		%data = restWords(Heightfield_operation.getRowTextById(%id));
   		%tab  = getField(%data,1);
   		echo("Tab data: " @ %data @ " tab: " @ %tab);
   		%tab.setVisible(true);
	}

detag(textTagString)

	function isNameUnique(%name)
	{
   		%count = ClientGroup.getCount();
   		for ( %i = 0; %i < %count; %i++ )
   		{
      			%test = ClientGroup.getObject( %i );
%rawName = stripChars( detag( getTaggedString( %test.name ) ), "\cp\co\c6\c7\c8\c9" );
      				if ( strcmp( %name, %rawName ) == 0 )
         					return false;
   		}
   		return true;
	}

getTag(textTagString)

	%tag = getTag(%variable);

echo(text [, ... ])

	echo( "This will be printed to the console");

warn(text [, ... ])

	warn("Warning, this will be printed to the console");

error(text [, ... ])

	error("Error Will Rogers, Error!");

expandEscape(text)

	%expanded = expandEscape(%variable);

collapseEscape(text)

	%colapsed = collapseEscape(%variable);

quit()

	quit();

call(funcName [,args ...])

	function clientCmdServerMessage(%msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10)
	{
   		%tag = getWord(%msgType, 0);
  			for(%i = 0; (%func = $MSGCB["", %i]) !$= ""; %i++)
      				call(%func, %msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10);

   		if(%tag !$= "")
      			for(%i = 0; (%func = $MSGCB[%tag, %i]) !$= ""; %i++)
         				call(%func, %msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10);
	}

compile(fileName)

	if( compile("/fps/client/scripts/script.cs") )
		echo("Compile success");

exec(fileName [, nocalls [,journalScript]])

	if( exec("/fps/client/scripts/script.cs"))
		echo("exec success");

export(searchString [, fileName [,append]])

	echo("Exporting server prefs");
	export("$Pref::Server::*", "./server/prefs.cs", False);

deleteVariables(wildCard)

	deleteVariables(*);

trace(bool)

	trace(1);

debug()

	debug();

findFirstFile (string pattern)

	findFirstFile("/fps", "*.cs");

findNextFile (string pattern)

	findNextFile("/fps", "*.cs");

getFileCount (string pattern)

	getFileCount("/fps/client/scripts", "*.cs");

getFileCRC(filename)

	getFileCRC("/fps/client/scripts/script/cs");

isFile(filename)

	isFile("/fps/client/scripts/script.cs");

isWriteableFileName(filename)

	isWriteableFileName("/fps/client/scripts/script.cs");

fileExt(filename)

	fileExt("script.cs"); // will return ".cs" as a string

fileBase(filename)

	fileBase("/fps/client/scripts/script.cs"); // will return "fps/client/scripts/script" as a string

fileName(filename)

	fileName("scripts.cs"); // will return "scripts" as a string

filePath(filename)

	filePath("/fps/client/scripts/script.cs"); // Will return "fps/client/scripts/" as a string

nextToken (str,token,delim)

	nextToken("A,E,I,O,U", voul, ";");
	//First pass vould would be equal to A, the next iteration would set vould to E, then I then O and finaly U.

setLogMode(mode)

	SetLogMode(1);

setEchoFileLoads(bool)

	setEchoFileLoads(1);

backtrace()

	backtrace();

isPackage(packageName)

	isPackage(Show);

activatePackage(packageName)

	activatePackage(Show);

deactivatePackage(packageName)

	deactivePackage(Show);

nameToID(object)

	nameToId(%player);

isObject(object)

	isObject(%player);

cancel(eventId)

   	// if centerprint already visible, reset text and time.
   	if ($centerPrintActive) {
      		if (centerPrintDlg.removePrint !$= "")
         			cancel(centerPrintDlg.removePrint);
   	}

isEventPending(%scheduleID)

	$Game::Schedule = schedule($Game::EndGamePause * 1000, 0, "onCyclePauseEnd");
	if( isEventPending($Game::Schedule) )
		echo("got a pending event");

schedule(time, command, )

	$Game::Schedule = schedule($Game::EndGamePause * 1000, 0, "onCyclePauseEnd");

deleteDataBlocks()

	deleteDataBlocks();

telnetSetParameters( port, consolePass, listenPass )

	telnetSetParameters(4123, "Garage", "Games");

dbgSetParameters (port, pass)

	dbgSetParameters(1130, "morbid");

dnetSetLogging(bool)

	dnetSetLogging(1);

setNPatch(bool, int)

	setNPatch(1, 1);

toggleNPatch()

	toggleNPatch();

increaseNPatch()

	increaseNPatch();

decreaseNPatch()

	decreaseNPatch():

setFSAA
	See setNPatch()

IncreaseFSAA
	See increaseNPatch()

decreaseFSAA
	See decreaseNPatch()

setOpenGLMipReduction(0 - 5)

	setOpenGlMipReduction(2);

setOpenGLSkyMipReduction(0 - 5)

	setOpenGlMipReduction(2);

setOpenGLInteriorMipReduction(0 - 5)

	setOpenGLInteriorMipReduction(2);

setOpenGLTextureCompressionHint (GL_DONT_CARE|GL_FASTEST|GL_NICEST)

	setOpenGLTextureCompressionHint(GL_NICEST);

setOpenGLAnisotropy( 0 - 1 )

	setOpenGLAnisotropy(0);

clearTextureHolds()

	   // Dump anything we're not using
   	clearTextureHolds();

addMaterialMapping( materialName, Sound, Color)

	addMaterialMapping( "sand" , "sound: 0" , "color: 0.46 0.36 0.26 0.4 0.0" );

aiConnect( val 0..N)

	aiConnect(1);

aiAddPlayer ( 'playerName'[, 'AIClassType'] )

	aiAddPlayer("BotBoy");

setPowerAudioProfiles (powerUp, powerDown)

calcExplosionCoverage( NEED FUNCTION PROTOTYPE!! )

      %coverage = calcExplosionCoverage(%position, %targetObject,
         $TypeMasks::InteriorObjectType |  $TypeMasks::TerrainObjectType |
         $TypeMasks::ForceFieldObjectType | $TypeMasks::VehicleObjectType);
      if (%coverage == 0)
         continue;

gotoWebPage( address )

	gotoWebPage("http://www.garagegames.com");

deactivateDirectInput()

	deactivateDirectInput();

activateDirectInput()

	activateDirectInput();

strToPlayerName(string)

%name = stripTrailingSpaces( strToPlayerName( %name ) );

stripTrailingSpaces(string)

%name = stripTrailingSpaces( strToPlayerName( %name ) );

setDefaultFov(defaultFOV)

	setDefaultFov( $pref::Player::defaultFov );

setZoomSpeed(speed)

	setZoomSpeed( $pref::Player::zoomSpeed );

setFov(FOV)

	setFov( $Pref::player::CurrentFOV );

screenShot(filename)

	screenShot("MyScreen");

panoramaScreenShot(filename)

	panoramaScreenShot("WideEyedScreenShot");

purgeResources()

	purgeResources();

lightScene( , )

   if (lightScene("sceneLightingComplete", ""))
   {
      error("Lighting mission....");
      schedule(1, 0, "updateLightingProgress");
      onMissionDownloadPhase3(%missionName);
      $lightingMission = true;
   }

flushTextureCache()

	flushTextureCache();

dumpTextureStats()

	dumpTextureStats();

dumpResourceStats()

	dumpResourceStats();

getControlObjectAltitude()

	%player.getControlObjectAltitude();

getControlObjectSpeed()

	%player.getControlObjectSpeed();

containerFindFirst(type, point, x, y, z)

containerFindNext()

snapToggle()

	snapToggle();

getVersionNumber()

	echo("Version Number: " @ getVersionNumber() );

getVersionString()

	echo("Version Number: " @ getVersionNumber() );

getCompileTimeString()

	function aboutDlg::onWake(%this)
	{
		%text="Torque Game Engine Test Application\n( v1.1.1 )\n"@
		""@ getCompileTimeString() @", "@ getBuildString() @"Build\n\n"@
		"Copyright (c) 2001 GarageGames.Com\n"@
		"Portions Copyright (c) 2001 by Sierra Online, Inc.\n\n"@
		"";
		aboutText.setText(%text);
	}

getBuildString()

	function aboutDlg::onWake(%this)
	{
		%text="Torque Game Engine Test Application\n( v1.1.1 )\n"@
		""@ getCompileTimeString() @", "@ getBuildString() @"Build\n\n"@
		"Copyright (c) 2001 GarageGames.Com\n"@
		"Portions Copyright (c) 2001 by Sierra Online, Inc.\n\n"@
		"";
		aboutText.setText(%text);
	}

getSimTime()

	function timeMetricsCallback()
	{
		return fpsMetricsCallback() @
		 "  Time -- " @
		 "  Sim Time: " @ getSimTime() @
		 "  Mod: " @ getSimTime() % 32;
	}

getRealTime()

	echo("Time in milliseconds: " @ getRealTime() );

setNetPort(port)

	function portInit(%port)
{
   		%failCount = 0;
   		while(%failCount < 10 && !setNetPort(%port)) {
			echo("Port init failed on port " @ %port @ " trying next port.");
			%port++; %failCount++;
   		}
}

lockMouse(isLocked)

	function cursorOff()
	{
		if ( $cursorControlled )
			lockMouse(true);
		Canvas.cursorOff();
	}

rebuildModPaths()

	rebuildModPaths();

setModPaths(path)

	// Set the mod path which dictates which directories will be visible
	// to the scripts and the resource engine.
	$modPath = pushback($userMods, $baseMods, ";");
	setModPaths($modPath);

getModPaths()

	$modPath = getModPaths();

createCanvas(WindowTitle)

if (!createCanvas(%windowName)){
      		quit();
      		return;
   	}

saveJournal(jname)

      //--------------------
      case "-jSave":
         $argUsed[$i]++;
         if ($hasNextArg)
         {
            echo("Saving event log to journal: " @ $nextArg);
            saveJournal($nextArg);
            $argUsed[$i+1]++;
            $i++;
         }
         else
            error("Error: Missing Command Line argument. Usage: -jSave ");

playJournal(jname,[break])

      //--------------------
      case "-jPlay":
         $argUsed[$i]++;
         if ($hasNextArg)
         {
            playJournal($nextArg,false);
            $argUsed[$i+1]++;
            $i++;
         }
         else
            error("Error: Missing Command Line argument. Usage: -jPlay ");

addTaggedString (string)

   // Tag the name with the "smurf" color:
   %client.nameBase = %name;
   %client.name = addTaggedString("\cp\c8" @ %name @ "\co");

removeTaggedString(tag)

	removeTaggedString(%client.name);

getTaggedString(tag)

%name = getTaggedString( %client.name );

buildTaggedString(fmtTag, )

	%MyTagedString = builtTaggedString(%client.name, %string);

commandToServer(func, )

function SADSetPassword(%password)
{
  		commandToServer('SADSetPassword', %password);
}

commandToClient(client, func, )

function chatMessageClient( %client, %sender, %voiceTag, %voicePitch, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10 )
{
		//see if the client has muted the sender
		if ( !%client.muted[%sender] )
		commandToClient( %client, 'ChatMessage', %sender, %voiceTag, %voicePitch, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10 );
}

allowConnections(bool)

      // Make sure the network port is set to the correct pref.
      portInit($Pref::Server::Port);
      allowConnections(true);

connect(addr)

	connect(ip:192.168.0.1:4123);

localConnect()

//----------------------------------------
function SM_StartMission()
{
   %id = SM_missionList.getSelectedId();
   %mission = getField(SM_missionList.getRowTextById(%id), 1);

   if ($pref::HostMultiPlayer)
      %serverType = "MultiPlayer";
   else
      %serverType = "SinglePlayer";

   createServer(%serverType, %mission);
   localConnect($pref::Player::Name);
}

startRecord(filename)

	startRecord(MyNiftyDemo);

stopRecord()

	stopRecord();

playDemo(filename)

	playDemo(MyNiftyDemo);

isDemoRecording()

	if( isDemoRecording())
		echo("Can only record one demo at a time"):

msg(id,msg)

	msg(%someObject, somemessage);

queryMasterServer (port,flags,gametyoe,missiontype,minplayers,maxplayers,maxbots,regionmask,maxping,maxcpu,filterflags)

function JoinServerGui::query(%this)
{
   queryMasterServer(
      28000,      // lanPort for local queries
      0,          // Query flags
      $Client::GameTypeQuery,       // gameTypes
      $Client::MissionTypeQuery,    // missionType
      0,          // minPlayers
      100,        // maxPlayers
      0,          // maxBots
      2,          // regionMask
      0,          // maxPing
      100,        // minCPU
      0           // filterFlags
      );
}

cancelServerQuery()

function JoinServerGui::cancel(%this)
{
   		cancelServerQuery();
}

stopServerQuery()

function JoinServerGui::stop(%this)
{
   		stopServerQuery();
}

startHeartbeat()

      if ($pref::Net::DisplayOnMaster !$= "Never" )
         schedule(0,0,startHeartbeat);

stopHeartbeat()

function destroyServer()
{
   		$Server::ServerType = "";
   		$missionRunning = false;
   		allowConnections(false);
   		stopHeartbeat();
…
…
}

getServerCount()

//----------------------------------------
function JoinServerGui::update(%this)
{
   		// Copy the servers into the server list.
   		JS_queryStatus.setVisible(false);
   		JS_serverList.clear();
   		%sc = getServerCount();
		…
		…
}

setServerInfo(index)

//----------------------------------------
function JoinServerGui::join(%this)
{
   		cancelServerQuery();
   		%id = JS_serverList.getSelectedId();

   		// The server info index is stored in the row along with the
   		// rest of displayed info.
   		%index = getField(JS_serverList.getRowTextById(%id),6);
   		if (setServerInfo(%index)) {
			connect($ServerInfo::Address,$Client::Password,$pref::Player::Name);
   		}
}

setShadowDetailLevel(0..1)

// Copy saved script prefs into C++ code.
setShadowDetailLevel( $pref::shadows );
setDefaultFov( $pref::Player::defaultFov );
setZoomSpeed( $pref::Player::zoomSpeed );

showShapeLoad (shapeName,faceCamera)

command = "getLoadFilename(\"*.dts\", showShapeLoad);";

showSequenceLoad( sequenceFile,[sequenceName])

command = "getLoadFilename(\"*.dsq\", showSequenceLoad);";

showTurnLeft(amt)

showMoveMap.bind(keyboard, z, showTurnLeft);

showTurnRight(amt)

	showMoveMap.bind(keyboard, x, showTurnRight);

showUpdateThreadControl()

showUpdateThreadControl();

showSelectSequence()

	showSelectSequence();

showPlay([threadNum])

	command = "showPlay(threadList.getValue());";

showStop([threadNum])

	command = "showStop(threadList.getValue());";

showSetScale(threadNum,Scale)

new GuiTextEditCtrl(showScale)
{
profile = "GuiTextEditProfile";
position = "80 20";
         	extent = "50 20";
altCommand = "showSetScale(threadList.getValue(),showScale.getValue()); Canvas.popDialog(TSShowEditScale);";
}

showSetPos(theadNum, pos)

showSetPos(threadList.getValue(),showScale.getValue());

showNewThread()

	command = "showNewThread();";

showDeleteThread(threadNum)

	command = "showDeleteThread(threadList.getValue());";

showToggleRoot()

	command = "showToggleRoot();";

showToggleStick()

	command = "showToggleStick();";

showSetCamera(bool)

command = "showSetCamera(true); showSetKeyboard(false);";

showSetKeyboard(bool)

command = "showSetCamera(true); showSetKeyboard(false);";

showSetLightDirection()

      new GuiButtonCtrl ()
      {
         profile  = "GuiButtonProfile";
         position = "40 330";
         extent   = "60 20";
         text = "Set Direction";
         command = "showSetLightDirection();";
      };

showSetDetailSlider()

function showToggleDetail()
{
		if ($showAutoDetail)
   		{
   			showDetailText.setValue("Slider Sets Detail Level");
      		showSetDetailSlider();
      		$showAutoDetail = false;
   		}
   		else
   		{
   			showDetailText.setValue("Auto Detail Using Distance");
      		$showAutoDetail = true;
   		}

}

StripMLControlChars(string)

function PlayerListGui::update
(%this,%clientId,%name,%isSuperAdmin,%isAdmin,%isAI,%score)
{
   	// Build the row to display.  The name can have ML control tags,
   	// including color and font.  Since we're not using and
   	// ML control here, we need to strip them off.
   		%tag = %isSuperAdmin? "[Super]":
          	(%isAdmin? "[Admin]":
          (%isAI? "[Bot]":
          ""));
   		%text = StripMLControlChars(%name) SPC %tag TAB %score;
…
…
}

setInteriorRenderMode(modeNum)

function cycleDebugRenderMode(%val)
{
   		if (!%val)
      		return;
   		if($MFDebugRenderMode == 0)
   		{
      		// Outline mode, including fonts so no stats
      		$MFDebugRenderMode = 1;
      		GLEnableOutline(true);
   		}
   		else if ($MFDebugRenderMode == 1)
   		{
      		// Interior debug mode
      		$MFDebugRenderMode = 2;
      		GLEnableOutline(false);
      		setInteriorRenderMode(7);
      		showInterior();
   		}
   		else if ($MFDebugRenderMode == 2)
   		{
      		// Back to normal
      		$MFDebugRenderMode = 0;
      		setInteriorRenderMode(0);
      		GLEnableOutline(false);
      		show();
   		}
}

setInteriorFocusedDebug()

setInteriorFocusedDebug();

isPointInside(point)

	isPointInside("143 34  567");

VectorAdd(vect1,vect2)

   %muzzleVelocity = VectorAdd(
      VectorScale(%muzzleVector, %projectile.muzzleVelocity),
      VectorScale(%objectVelocity, %projectile.velInheritFactor));

VectorSub(vect1,vect2)

      // Apply the impulse
      if (%impulse) {
         %impulseVec = VectorSub(%targetObject.getWorldBoxCenter(), %position);
         %impulseVec = VectorNormalize(%impulseVec);
         %impulseVec = VectorScale(%impulseVec, %impulse * %distScale);
         %targetObject.applyImpulse(%position, %impulseVec);
      }

VectorScale(vect,scalar)

      // Apply the impulse
      if (%impulse) {
         %impulseVec = VectorSub(%targetObject.getWorldBoxCenter(), %position);
         %impulseVec = VectorNormalize(%impulseVec);
         %impulseVec = VectorScale(%impulseVec, %impulse * %distScale);
         %targetObject.applyImpulse(%position, %impulseVec);
      }

VectorNormalize(vec)

      // Apply the impulse
      if (%impulse) {
         %impulseVec = VectorSub(%targetObject.getWorldBoxCenter(), %position);
         %impulseVec = VectorNormalize(%impulseVec);
         %impulseVec = VectorScale(%impulseVec, %impulse * %distScale);
         %targetObject.applyImpulse(%position, %impulseVec);
      }

VectorDot(vec1,vec2)

   // Add a vertical component to give the object a better arc
   %verticalForce = %throwForce / 2;
   %dot = vectorDot("0 0 1",%eye);

VectorCross(vec1,vec2)

%vecCross = vectorCross("x y z","x y z");

VectorDist(vect1,vect2)

	%disatance = vectorDist(vector1,vector2);

VectorLen(vec)

	%length = vectorLen(vector);

VectorOrthoBasis(AngAxisF)

	%ortho = vectorOrthoBasis("x y z angle");

MatrixCreate(Pos,Rot)

	%mat = matrixCreate("x y z", "x y z angle");

MatrixMultiply(Left,Right)

	%newMatrix = matrixMultiply(matrix1,matrix2);

MatrixMulVector(transform, vector)

	%daMatrix = matrixMulVector(matrix,vector);

MatrixMulPoint(transfor,point)

	%daMatrix = matrixMulPoint(matrix,point);

getBoxCenter(Box)

// Set the object's position and initial velocity
   	%pos = getBoxCenter(%this.getWorldBox());

setRandomSeed([seed])

function initCommon()
{
   		// All mods need the random seed set
   		setRandomSeed();

   		// Very basic functions used by everyone
   		exec("./client/canvas.cs");
   		exec("./client/audio.cs");
}

getRandomSeed()

	%seed = getRandomSeed();

getRandom([[max]||[min,max]])

	%random = getRandom(34,176);

MatrixCreateFromEuler (\"x y z\")

	%daMatrix = MatrixCreateFromEuler("x y z");

mSolveQuadratic(a,b,c)

	%quad = mSolveQuadratic(a,b,c);

mSolveCubic(a,b,c,d)

%cube =	mSolveCubic(a,b,c,d);

mSolveQuartic(a,b,c,d,e)

	%quartic = mSolveQuartic(a,b,c,d,e);

mFloor(float)

   %pageLines = mFloor(%chatScrollHeight / %textHeight);
   if (%pageLines <= 0)
      %pageLines = 1;

mCeil(float)

	%min = mCeil(%chatScrollHeight / %textHeight);

mFloatLength(float, numDecimals)

	%newFloat = mFloatLength((7/3),5);

mAbs(float)

	%abs = mAbs(76.3);

mSqrt(float)

	%sqrt = mSqrt(69);

mPow(floatA,floatB)

	%pow = mPow(2,4);

mLog(float)

	%log = mLog(7654.98);

mSin(float)

	%sin = mSin(65);

mCos(float)

	%cos = mCos(69);

mTan(float)

	%tan = mTan(87.6);

mAsin(float)

	%asin = mAsin(-3,8);

mAcos(float)

	%acos = mAcos(-8,3);

mAtan(float)

	%atan = mAtan(-10,3);

mRadToDeg(float)

	%r2d = mRadToDeg(5);

mDegToRad(float)

	%c2r = mDegToRad(171);

ValidateMemory()

	ValidateMemory();

FreeMemoryDump()

	FreeMemoryDump();

dumpMemSnapshot(filename)

	dumpMemSnapshot(memdump.txt);

redbookOpen()

redbookOpen();

redbookClose()

	redbookClose();

redbookPlay(track)

	redbookPlay(2);

redbookStop()

	redbookStop();

redbookGetTrackCount()

	%tracks = redbookGetTrackCount();

redbookGetVolume()

	%volume = redbookGetVolume();

redbookSetVolume(volume)

	redbookSetVolume(%volume);

redbookGetDeviceCount()

	%count = redbookGetDeviceCount();

redbookGetDeviceName(idx)

	echo("Red Book (whats that?) device name :" @ redbookGetDeviceName(1) );

redbookGetLastError()

	echo("RedBook (whats that?) last known error :" @ redbookGetLastError() );

videoSetGammaCorrection(gamma)

	videoSetGammaCorrection($pref::OpenGL::gammaCorrection);

setDisplayDevice(deviceName{, width{, height{, bpp{, fullScreen}}}}} )

function optionsDlg::applyGraphics( %this )
{
		%newDriver = OptGraphicsDriverMenu.getText();
		%newRes = OptGraphicsResolutionMenu.getText();
		%newBpp = OptGraphicsBPPMenu.getText();
		%newFullScreen = OptGraphicsFullscreenToggle.getValue();

		if ( %newDriver !$= $pref::Video::displayDevice )
		{
setDisplayDevice( %newDriver, firstWord( %newRes ), getWord( %newRes, 1 ), %newBpp, %newFullScreen );
			//OptionsDlg::deviceDependent( %this );
		}
		else
setScreenMode( firstWord( %newRes ), getWord( %newRes, 1 ), %newBpp, %newFullScreen );
}

setScreenMode(width, height, bpp, fullScreen)

setScreenMode( firstWord( %newRes ), getWord( %newRes, 1 ), %newBpp, %newFullScreen );

toggleFullScreen()

	toggleFullScreen();

isFullScreen()

	if(isFullScreen())
		echo("We be full screened!");

switchBitDepth()

	if(!switchBitDepth())
		echo("Unable to switch screen bpp");

prevResolution()

	if(!prevResolution ())
		echo("Unable to switch screen resolution");

nextResolution()

	if(!nextResolution ())
		echo("Unable to switch screen resolution");

getResolution()

	%res = getResolution():

setResolution(width, height, bpp)

	if(!setResolution(640,480,32);)
		echo("Unable to set resolution to 640x480x32");

setRes(width, height, bpp)

getDisplayDeviceList()

	echo("Display Device(s) :" @ getDisplayDeviceList() );

getResolutionList(devicename)

	echo("Possible resolutions :" @ getResolutionList(%device) );

getVideoDriverInfo()

	echo("Device driver info :" @ getVideroDriverInfo() );

isDeviceFullScreenOnly(devicename)

	if(isDeviceFullScreenOnly(%devicename) )
		echo("You are limited to fullscreen mode only!"):

setVerticalSync()

	if(!setVerticalSync(1) )
		echo("Unable to enable Vertical Sync for your video device");

profilerMarkerEnable(markerName, true/false)

profilerMarkerEnable(mark,true);

profilerEnable(true/false)

	profilerEnable(false);

profilerDump()

	profilerDump();

profilerDumpToFile(filename)

	profileDumpToFile(dump.txt);

enableWinConsole(bool)

	    case "-console":
         		enableWinConsole(true);
         		$argUsed[$i]++;

isJoystickDetected()

	if(!isJoystickDetected())
		echo("No Joystick was detected");

getJoystickAxes( instance )

	%joyAxes = getJoystickAxes( 3 );

enableMouse()

	enableMouse();

disableMouse()

	disableMouse();

permDisableMouse()

	permDisableMouse();

echoInputState()

	echoInputState();

toggleInputState()

toggleInputState();

MathInit( detect|C|FPU|MMX|3DNOW|SSE|...)

	MathInit(detect);

AddCardProfile( vendor,renderer,safeMode,lockArray,subImage,fogTexture,noEnvColor,clipHigh,deleteContext,texCompress,interiorLock,skipFirstFog,only16,noArraysAlpha,proFile)

addOSCardProfile(vendor,renderer,allowOpenGL,allowD3D,preferOpenGL)

getDesktopResolution()

	%res = getDesktopResolution():

activateKeyboard()

	if(activateKeyboard())
		echo("Keyboard has been activated");

deactivateKeyboard()

	deactivateKeyboard();

GLEnableLogging(bool)

	GLEnableLoggin(true);

GLEnableOutline(bool)

	GLEnableOutline(true);

GLEnableMetrics(bool)

	GLEnableMetrics(1);

inputLog(string)

	inputLog(DI.log);

launchDedicatedServer(missionType, map, botCount )

	launchDedicatedServer(mymission,damap,0);

isKoreanBuild()

if(isKoreanBuild())
	echo("Silly Korean Build!");

debug_testx86unixmutex()

	debug_testx86unixmutex();

debug_debugbreak()

debug_debugbreak();

resetLighting()

	resetLighting();

getMaxFrameAllocation()

	%maxFrameAlloc = getMaxFrameAllocation();

dumpNetStringTable()

	dumpNetStringTable();

InitContainerRadiusSearch (\"x y z\", radius, mask)

	InitContainerRadiusSearch ("0 450 76", %somerad, %somemask)

ContainerSearchNext()

	while(ContainerSearchNext() != -1 )
	{
		…
		…
	}

ContainerSearchCurrDist()

	%dist = ContainerSearchCurrDist();

ContainerSearchCurrRadiusDist()

	%rad = ContainerSearchCurrRadiusDist();

ContainerRayCast (\"x y z\", \"x y z\", mask, [exempt object])

// Search for objects within the range that fit the masks above
// If we are in first person mode, we make sure player is not selectable by setting fourth parameter (exempt
   	// from collisions) when calling ContainerRayCast
   	%player = %client.player;
   	if ($firstPerson)
   	{
%scanTarg = ContainerRayCast (%cameraPoint, %rangeEnd, %searchMasks, %player);
   	}
   	else //3rd person - player is selectable in this case
   	{
%scanTarg = ContainerRayCast (%cameraPoint, %rangeEnd, %searchMasks);
   	}

ContainerBoxEmpty(Mask, Loc, Rad [,yRad, zRad])

pathOnMissionLoadDone()

   	pathOnMissionLoadDone();

makeTestTerrain(filename)

getTerrainHeight(Point2I pos)

	%TerHeight = getTerrainHeight(%pos);