718 Appendix A ■ The Torque Game Engine Reference
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 |
Row of interest in the server list. |
Return: |
numeric |
1 = success, 0 = fail. |
Description: |
Changes our indexed reference into the ServerList. |
Usage: |
%result = SetServerInfo(%index); |
SetShadowDetailLevel(level)
Parameters: |
level |
Numeric range 0.0 to 1.0. |
Return: |
nothing |
|
Description: |
Sets the level of detail for shadows. |
Usage: |
SetShadowDetailLevel( 1.0 ); |
SetVerticalSync(switch)
Parameters: |
switch |
1 enables, 0 disables. |
Return: |
numeric |
1 = true, 0 = false. |
Description: |
Enables or disables the use of VerticalSync. |
Usage: |
SetVerticalSync(true); |
|
|
|
Torque Console Script Command Reference |
719 |
|
|
|
|
|
|
SetWord(text, index, subst) |
|
|
|
|
Parameters: |
text |
String with space-delimited words. |
|
|
|
index |
Word-based offset into the text string. |
|
|
|
subst |
Substitute string. |
|
|
Return: |
string |
The resultant string. |
|
|
Description: |
Substitutes the word-string sub for the word-string found at index in the string |
|
|
|
text. |
|
|
|
|
Usage: |
%str = SetWord(%text, 0, "blah"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
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 filename. |
|
|
Usage: |
StartRecording(myDemo); |
|
|
|
|
|
|
|
StopHeartbeat()
Parameters: none
Return: nothing
Description: Stops the heartbeat messages.
Usage: StopHeartbeat();
720 Appendix A ■ The Torque Game Engine Reference
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 |
First string. |
|
|
str2 |
Second string. |
|
Return: |
numeric |
< 0 |
str1 is less than (also not equal to) str2. |
|
|
0 |
str1 is equal to str2. |
|
|
> 0 |
str1 is greater than (also not equal to) str2. |
Description: |
Case-sensitive comparison of two strings: str1 and str2. |
Usage: |
if ( Strcmp( %weaponName, "candlestick" ) == 0 ) |
|
return %weaponFound; |
|
|
|
|
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. |
|
|
Usage: |
if ( Stricmp(%weaponName, "CandleStick") == 0 ) |
|
|
|
return %weaponFound; |
|
|
|
|
|
|
|
|
|
|
StripChars(str, chars)
Parameters: |
str |
String to be processed. |
|
chars |
String containing characters to be stripped. |
Return: |
string |
The processed resultant string. |
Description: |
Removes all characters in the string chars from the string str. |
Usage: |
%stripped = StripChars(%value, "~" ); |
StripMLControlChars(string)
Parameters: string
Return: string
Description: Strips ML special control characters from string.
Usage: %text = StripMLControlChars(%string);
StripTrailingSpaces(string)
Parameters: |
string |
Input string. |
Return: |
string |
|
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); |
722 |
Appendix A ■ |
The Torque Game Engine Reference |
|
|
|
|
|
|
|
|
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])
Parameters: |
str |
String to be searched. |
|
target |
String to find. |
|
offset |
Starts search at offset. (optional) |
Return: |
numeric |
|
Description: |
Finds the first occurrence of the target string in the search string, with optional |
|
starting offset. Note: This function is identical to strstr when offset isn't used. |
Usage: |
%pos = Strpos(%weaponName, "gun") ; |
|
Strreplace(str, target, |
subst) |
|
|
Parameters: |
str |
String to be processed. |
|
|
target |
Target string to be replaced. |
|
|
subst |
Substitute string. |
|
Return: |
string |
The processed resultant string. |
|
Description: |
Replaces all instances of target 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" ); |
|
|
|
|
|
|
|
|
Torque Console Script Command Reference |
723 |
|
|
|
|
|
|
StrToPlayerName(string); |
|
|
|
|
Parameters: |
string |
Player name string. |
|
|
Return: |
string |
|
|
|
|
Description: |
Converts name string to properly formatted player name string. Proper formatting |
|
|
|
means the player name is limited to 16 characters in length. Leading and trailing |
|
|
|
spaces are trimmed; reserved characters are removed. |
|
|
Usage: |
%newname = StrToPlayerName( %name ); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Strupr(str) |
|
|
|
|
|
Parameters: |
str |
String to be processed. |
|
|
Return: |
string |
The processed resultant string. |
|
|
Description: |
Converts all characters in str to uppercase. |
|
|
Usage: |
%var = Strupr(%value); |
|
|
|
|
|
|
|
SwitchBitDepth()
Parameters: |
none |
|
Return: |
numeric |
1 = success, 0 = fail. |
Description: |
Switches between 16 and 32 bits per pixel in full-screen mode. |
Usage: |
%result = SwitchBitDepth(); |
TelnetSetParameters( port, consolePW, listenPW )
Parameters: |
port |
Connection port. |
|
consolePW |
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(); |
724 Appendix A ■ The Torque Game Engine Reference
ToggleInputState()
Parameters: |
none |
Return: |
nothing |
Description: |
Toggles DirectInput state between enabled and disabled. Also prints the new |
|
input state (same as echoInputState) to the console. |
Usage: |
ToggleInputState(); |
ToggleNPatch()
Parameters: |
none |
Return: |
nothing |
Description: |
Toggles the enable/disable state of Npatch. |
Usage: |
ToggleNPatch(); |
Trace(switch)
Parameters: |
switch |
1 (or true) enables, 0 (or false) disables. |
Return: |
nothing |
|
Description: |
Turns execution trace on or off. |
Usage: |
Trace(true); |
|
Trim(str)
Parameters: |
str |
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();
726 Appendix A ■ The Torque Game Engine Reference
VectorNormalize(vector)
Parameters: |
vector |
"x y z". |
Return: |
string |
|
Description: |
Normalizes a vector. |
Usage: |
%nvector = VectorNormalize("5 10 30"); |
VectorOrthoBasis(vector)
Parameters: |
vector |
"x y z". |
Return: |
string |
|
Description: |
Computes the orthogonal normal for a vector. |
Usage: |
%normal = VectorOrthoBasis("x y z angle"); |
VectorScale(vector, scalar)
Parameters: |
vector |
"x y z". |
|
scalar |
Can be an integer or a floating point. |
Return: |
string |
|
Description: |
Computes the result of the vector sized by the scale. |
Usage: |
%svector = VectorScale("5 10 30", 100); |
VectorSub(vector1, vector2)
Parameters: |
vector1 |
"x y z". |
|
vector2 |
"x y z". |
Return: |
string |
|
Description: |
Subtracts vector2 from vector1. |
Usage: |
%result = VectorSub("34.0989 989.3249 100.00", %position); |
VideoSetGammaCorrection(gamma)
Parameters: |
gamma |
Gamma correction setting. |
Return: |
nothing |
|
Description: |
Sets the gamma correction. |
Usage: |
VideoSetGammaCorrection(0.5); |
|
|
|
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!!"); |
|
|
|
|
|
|
|
Torque Reference Tables
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 |
WaterObjectType |
16 |
5 |
TriggerObjectType |
32 |
6 |
MarkerObjectType |
64 |
7 |
unassigned |
128 |
8 |
unassigned |
256 |
9 |
DecalManagerObjectType |
512 |
10 |
GameBaseObjectType |
1024 |
11 |
ShapeBaseObjectType |
2048 |
12 |
CameraObjectType |
4096 |
13 |
StaticShapeObjectType |
8192 |
14 |
PlayerObjectType |
16384 |
15 |
ItemObjectType |
32768 |
16 |
VehicleObjectType |
65536 |
17 |
VehicleBlockerObjectType |
131072 |
18 |
ProjectileObjectType |
262144 |
19 |
ExplosionObjectType |
524288 |
20 |
unassigned |
2097152 |
21 |
CorpseObjectType |
1048576 |
22 |
DebrisObjectType |
4194304 |
23 |
PhysicalZoneObjectType |
8388608 |
24 |
unassigned |
33554432 |
25 |
StaticTSObjectType |
16777216 |
26 |
continued