Torque Console Script Command Reference 717
SetOpenGLMipReduction(level)
Parameters: level
Mipmap level (0 = minimum detail, 5 = maximum detail).
Return: nothing
Description:
Sets shape texture detail to
level.
Usage:
SetOpenGLMipReduction(2);
SetOpenGLSkyMipReduction(level)
Parameters: level
Mipmap level (0 = minimum detail, 5 = maximum detail).
Return: nothing
Description:
Sets skybox and cloud texture detail.
Usage:
SetOpenGLMipReduction(2);
SetRandomSeed([seed])
Parameters: seed
Starting point.
Return: nothing
Description:
Sets the current starting point for generating a series of pseudo-random numbers.
Usage:
SetRandomSeed();
SetRecord (text, index, subst)
Parameters: text
String with new line-delimited records.
index
Record-based offset into the text string.
SetResolution(width, height, bpp)
Parameters: width
Screen width.
height
Screen height.
bpp
Bits per pixel.
Return: numeric
1 = success, 0 = fail.
Description:
Sets the screen resolution to specified values.
Usage:
%result = SetResolution(640,480,32);
SetScreenMode(width, height, bpp, fullScreen)
Parameters: width
Screen width.
height
Screen height.
bpp
Bits per pixel.
fullScreen
1 enables, 0 disables.
Return: numeric
1 = success, 0 = fail.
Description:
Sets up the screen with specified values.
Usage:
%result = SetScreenMode( 800, 600, 32, true );
SetServerInfo(index)
Parameters: index
Usage:
SetVerticalSync(true);
Team LRN
Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark.
Torque Console Script Command Reference 719
SetZoomSpeed( speed )
Parameters: speed
Transition speed. Ranges from 0 to 2,000 milliseconds.
Return: nothing
Description:
Sets the transition speed when changing field of view.
Usage:
SetZoomSpeed( speed );
StartHeartbeat()
Parameters: none
Return: nothing
Description:
Begins periodic messages to the master server that show that this server is still
alive.
Usage:
schedule(0,0,StartHeartbeat);
StartRecording(filename)
Parameters: filename
String containing file name.
Return: nothing
Description:
Records a demo and saves it as f
ilename
.
Usage:
■
The Torque Game Engine Reference720
StopRecording()
Parameters: none
Return: nothing
Description:
Stops the currently recording demo.
Usage:
StopRecording();
StopServerQuery()
Parameters: none
Return: nothing
Description:
Cancels the current query and marks outstanding pings as finished.
Usage:
StopServerQuery();
Strchr(str, char)
Parameters: str
String to be processed.
char
String containing the character to be found.
Return: string
Description:
Finds the first substring in the string that begins with
char
.
Usage:
%file = Strchr("data/file.dat", "/" );
Strcmp(str1, str2)
Parameters: str1
Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark.
Torque Console Script Command Reference 721
Stricmp(str1, str2)
Parameters: str1
First string.
str2
Second string.
Return: numeric
< 0
str1
is less than (not equal to)
str2
.
0
str1
is equal to
str2
.
> 0
str1
is greater than (not equal to)
str2
.
Description:
Case-
insensitive
comparison of two strings:
str1
and
str2
Description:
Strips trailing spaces and underscores from string to be used for player name.
Usage:
%name = StripTrailingSpaces( strToPlayerName( %name ) );
Strlen(str)
Parameters: str
String.
Return: numeric
Description:
Obtains the number of characters in
str.
Usage:
%len = Strlen(%weaponName);
Team LRN
Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark.
Appendix A
■
The Torque Game Engine Reference722
Strlwr(str)
Parameters: str
String to be processed.
Return: string
The processed resultant string.
Description:
Converts all characters in
str
to lowercase.
Usage:
%var = Strlwr(%value);
Strpos(str, target[, offset])
and replaces with
subst
.
Usage:
%dospath = Strreplace(%path, "/", "\");
Strstr(str, target)
Parameters: str
String to be tested.
target
Target substring to find.
Return: numeric
Offset within
str
where
target
was found.
Description:
Finds first occurrence of a
target
within
string
.
Usage:
%loc = Strstr( %weaponName, "stick" );
Team LRN
Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark.
Torque Console Script Command Reference 723
StrToPlayerName(string);
Parameters: string
Player name string.
Console password.
listenPW
"Listener" password.
Return: nothing
Description:
Initializes telnet connection request parameters.
Usage:
TelnetSetParameters(4123, "garage", "games");
ToggleFullScreen()
Parameters: none
Return: numeric
1 = success, 0 = fail.
Description:
Switches between windowed mode and full-screen mode.
Usage:
%result = ToggleFullScreen();
Team LRN
Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark.
Appendix A
■
The Torque Game Engine Reference724
ToggleInputState()
Parameters: none
Return: nothing
Description:
Toggles
DirectInput
state between
enabled
and
String to be processed.
Return: string
The processed resultant string.
Description:
Strips any white space from
str
from the left or right sides (before and after all
other characters) of
str
. White space is defined as space, carriage returns, or new
line characters.
Usage:
%tidystring = Trim(%yuckystring);
ValidateMemory()
Parameters: none
Return: nothing
Description:
Ensures sufficient memory available for the program.
Usage:
ValidateMemory();
Team LRN
Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark.
Torque Console Script Command Reference 725
VectorAdd(vector1, vector2)
Parameters: vector1
"x y z".
vector2
"x y z".
Return: string
Description:
vector2
"x y z".
Return: string
Description:
Computes the dot product between two vectors.
Usage:
%product = VectorDot("0 0 1",%eye);
VectorLen(vector)
Parameters: vector
"x y z".
Return: string
Description:
Computes the length of the vector.
Usage:
%len = VectorLen(vector);
Team LRN
Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark.
Appendix A
■
The Torque Game Engine Reference726
VectorNormalize(vector)
Parameters: vector
"x y z".
Return: string
Description:
Normalizes a vector.
Usage:
%nvector = VectorNormalize("5 10 30");
VectorOrthoBasis(vector)
Parameters: vector
VideoSetGammaCorrection(gamma)
Parameters: gamma
Gamma correction setting.
Return: nothing
Description:
Sets the gamma correction.
Usage:
VideoSetGammaCorrection(0.5);
Team LRN
Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark.
Torque Reference Tables
Torque Reference Tables 727
Warn(text)
Parameters: text
String.
Return: nothing
Description:
Prints
text
to the console with light gray font. Text can be formatted according to
the string rules.
Usage:
Warn("Danger, Will Robinson!!");
Table A.1 Torque Script Object Type Masks
Mask Identifier Number Mask Bit Position
DefaultObjectType 0 0
StaticObjectType 1 1
EnvironmentObjectType 2 2
TerrainObjectType 4 3
InteriorObjectType 8 4
The Torque Game Engine Reference728
StaticRenderedObjectType 67108864 27
unassigned
268435456 28
unassigned
536870912 29
unassigned
1073741824 30
unassigned
2147483648 31
Table A.2 Torque Object Methods
Object Class Method
AIPlayer ai.moveForward()
ai.walk()
ai.run()
ai.stop()
ai.setMoveSpeed(float)
ai.setTargetObject(object)
ai.getTargetObject()
ai.targetInSight()
ai.aimAt( point)
ai.getAimLocation()
BanList BanList::add(id, TA, banTime)
BanList::addAbsolute(id, TA, banTime)
BanList::removeBan(id, TA)
BanList::isBanned(id, TA)
BanList::export(filename)
Camera camera.getPosition()
camera.setOrbitMode(obj, xform,min-dist,max-dist, cur-dist)
camera.setFlyMode()