Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:

3D Game Programming All In One (2004)

.pdf
Скачиваний:
140
Добавлен:
17.08.2013
Размер:
17.91 Mб
Скачать

708 Appendix A The Torque Game Engine Reference

ProfilerDump()

Parameters: none

Return: nothing

Description: Dumps NetStringTable statistics to the console.

Usage: ProfilerDump();

ProfilerDumpToFile(filename)

Parameters:

filename

String containing file name.

Return: nothing

Description: Dumps NetStringTable statistics to the file specified by filename.

Usage: ProfilerDumpToFile(dump.txt);

ProfilerEnable(switch)

Parameters:

switch

1 enables, 0 disables.

Return:

nothing

 

Description:

Enables or disables profiling.

Usage:

ProfilerEnable(false);

ProfilerMarkerEnable(markerName, switch)

Parameters:

markerName

Name of profile marker.

 

switch

1 enables, 0 disables.

Return:

nothing

 

Description:

Enables or disables profiling for markerName.

Usage:

ProfilerMarkerEnable(mark,true);

PurgeResources()

Parameters:

none

Return:

nothing

Description:

Purges all resources used by the game through the resource manager.

Usage:

PurgeResources();

Team LRN

Torque Console Script Command Reference 709

QueryMasterServer (port,flags,gametype,missiontype,minplayers,maxplayers, maxbots,regionmask,maxping,filterflags,mincpu,buddycount,buddylist)

Parameters:

port

Master server port.

 

flags

The query flags. Choices:

 

 

0x00

= online query

 

 

0x01

= offline query

 

 

0x02

= no string compression

 

gametype

Game type string.

 

missiontype

Mission type string.

 

minplayers

Minimum number of players for viable game.

 

maxplayers

Maximum allowable players.

 

maxbots

Maximum allowable connected AI bots.

 

regionmask

Numeric discriminating mask.

 

maxping

Maximum ping for connecting clients; 0 means no maximum.

 

filterflags

Server filters. Choices:

 

 

0x00

= dedicated

 

 

0x01

= not password protected

 

 

0x02

= Linux

 

 

0x80

= current version

 

mincpu

Minimum specified CPU capability.

 

buddycount

Number of buddy servers in buddy list.

 

buddylist

List of server names that are buddies to this server.

Return:

nothing

 

 

Description:

Queries a master server looking for specified information. The responses are

 

accessible from the ServerList array.

Usage:

QueryMasterServer(

 

 

28000, 0, $Client::GameTypeQuery, Client::MissionTypeQuery,

 

0, 100, 0, 2, 0, 100, 0, 0, "" );

Quit()

Parameters:

none

Return:

nothing

Description:

Quits the game.

Usage:

Quit();

Team LRN

710 Appendix A The Torque Game Engine Reference

RedbookClose()

Parameters:

none

 

Return:

numeric

1 = success, 0 = fail.

Description:

Closes the currently open redbook (CD) device.

Usage:

%result = RedbookClose();

RedbookGetDeviceCount()

Parameters:

none

Return:

numeric

Description:

Queries for the number of redbook (CD) devices.

Usage:

%count = RedbookGetDeviceCount();

RedbookGetDeviceName(idx)

Parameters:

idx

Device index.

Return:

string

 

Description:

Queries the device name of redbook (CD) at the specified device index.

Usage:

%name = RedbookGetDeviceName(1);

RedbookGetLastError()

Parameters:

none

Return:

string

Description:

Queries for the last error from a redbook (CD) device.

Usage:

%error = RedbookGetLastError();

RedbookGetTrackCount()

Parameters: none

Return: numeric

Description: Queries the number of redbook (CD) tracks.

Usage: %tracks = RedbookGetTrackCount();

Team LRN

Torque Console Script Command Reference 711

RedbookGetVolume()

Parameters:

none

Return:

numeric

Description:

Queries the current volume level of a redbook (CD) device.

Usage:

%volume = RedbookGetVolume();

RedbookOpen([name])

Parameters:

name

If non-null, specifies the device.

Return:

numeric

1 = success, 0 = fail.

Description:

Opens a redbook (CD) device.

Usage:

%result = RedbookOpen();

RedbookPlay(track)

Parameters:

track

Index of track.

Return:

numeric

1 = success, 0 = fail.

Description:

Plays a track on a redbook (CD) device.

Usage:

%result = RedbookPlay(2);

RedbookSetVolume(volume)

Parameters:

volume

Volume setting.

Return:

numeric

1 = success, 0 = fail.

Description:

Sets the volume of a redbook (CD) device.

Usage:

%result = RedbookSetVolume(%volume);

RedbookStop()

Parameters:

none

 

Return:

numeric

1 = success, 0 = fail.

Description:

Stops playing on the current redbook (CD) device.

Usage:

%result = RedbookStop();

Team LRN

712 Appendix A The Torque Game Engine Reference

RemoveField(text, index)

Parameters:

text

String with field-delimited words.

 

index

Field-based offset into the text string.

Return:

string

The resultant string.

Description:

Removes the field-string at index from text.

Usage:

%result = RemoveField(%text, 0);

RemoveRecord (text, index)

Parameters:

text

String with new line-delimited records.

 

index

Record-based offset into the text string.

Return:

string

The resultant string.

Description:

Removes the record-string at index from text.

Usage:

%str = RemoveRecord(%text, 0);

RemoveTaggedString(tag)

Parameters:

tag

Numeric tag of string to be removed.

Return:

nothing

 

Description:

Removes a tagged string from the list.

Usage:

RemoveTaggedString(%tagname);

RemoveWord(text, index)

Parameters:

text

String with space-delimited words.

 

index

Word-based offset into the text string.

Return:

string

The resultant string.

Description:

Removes the word-string at index from text.

Usage:

%str = RemoveWord(%text, 0);

ResetLighting()

Parameters: none

Return: nothing

Description: Resets the current lighting.

Usage: ResetLighting();

Team LRN

 

 

 

Torque Console Script Command Reference

713

 

 

 

 

 

 

RestWords(text)

 

 

 

 

Parameters:

text

String with space-delimited words.

 

 

Return:

string

The resultant string.

 

 

Description:

Returns the words remaining after the first word in text.

 

 

Usage:

%data = RestWords(%text);

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Rtrim(str)

 

 

 

 

 

Parameters:

str

String to be processed.

 

 

Return:

string

The processed resultant string.

 

 

Description:

Strips any white space from str from the right side (after all other characters) of

 

 

 

str. White space is defined as space, carriage returns, or new line characters.

 

 

Usage:

%tidystring = Rtrim(%yuckystring);

 

 

 

 

 

 

 

SaveJournal(name)

Parameters:

name

String containing file name of journal.

Return:

nothing

 

Description:

Save a journal to file specified by name.

Usage:

SaveJournal("myjrnl.jnl");

Schedule(time, reference, command, <arg1...argN>)

Parameters:

time

Time to wait for trigger, in milliseconds.

 

reference

Handle of object to attach schedule to, or 0.

 

command

Command to execute.

 

arg1…argN

Arguments to accompany command. (optional)

Return:

numeric

Event ID.

Description:

Schedules an event that will trigger in time milliseconds and execute command,

 

with args. If reference is not 0, then it must be a valid object handle. If the object

 

is deleted, the scheduled event is discarded.

Usage:

$evt = Schedule(5000, 0, "updateRadar");

ScreenShot(filename)

Parameters: filename String containing file name.

Return: nothing

Description: Captures the screen view and saves it to file specified by filename.

Usage: ScreenShot("myScreen");

Team LRN

714 Appendix A The Torque Game Engine Reference

SetDefaultFov( fov )

Parameters:

fov

Numeric in degrees.

Return:

nothing

 

Description:

Sets the default field of view.

Usage:

SetDefaultFov( 60 );

SetDisplayDevice(deviceName[, width[, height[, bpp[, fullScreen]]]] )

Parameters:

deviceName

Name of target device driver.

 

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 display device with specified values.

Usage:

%result = SetDisplayDevice ( "OpenGL", 800, 600, 32, true );

SetEchoFileLoads(switch)

Parameters:

switch

1 (or true) enables, 0 (or false) disables.

Return:

nothing

 

Description:

Enables or disables File Load echo to console.

Usage:

SetEchoFileLoads(1);

SetField(text, index, subst)

Parameters:

text

String with field-delimited words.

 

index

Field-based offset into the text string.

 

subst

Substitute string.

Return:

string

The resultant string.

Description:

Substitutes the field-string sub for the word-string found at index in the string

 

text.

 

Usage:

%rec = SetField(%text, 0, "blah");

Team LRN

 

 

 

Torque Console Script Command Reference

715

 

 

 

 

 

 

 

SetFov(val)

 

 

 

 

 

Parameters:

val

The field of view (degrees).

 

 

Return:

nothing

 

 

 

 

Description:

Sets the current field of view.

 

 

Usage:

SetFov(90);

 

 

 

 

 

 

 

 

 

SetFSAA(switch, level)

Parameters:

switch

1 enables, 0 disables.

 

level

Target level.

Return:

nothing

 

Description:

Invokes SetNPatch with the same parameters.

Usage:

SetFSAA(%newstate,%lvl)

SetInteriorFocusedDebug(which)

Parameters:

which Handle of interior for focus. If which has a value, then debugging is enabled;

 

if which is empty (not passed), then debugging is disabled.

Return:

nothing

Description:

Enables debug mode for interior focused objects.

Usage:

SetInteriorFocusedDebug();

SetInteriorRenderMode(mode)

Parameters: mode

Return: nothing

Description: Sets the detail render level for interiors.

Usage: SetInteriorRenderMode(7);

SetLogMode(mode)

Parameters:

mode

The numeric mode value. Choices:

 

 

0

= no logging

 

 

1

= logging on, append mode

 

 

2

= logging on, overwrite mode

Return:

nothing

 

 

Description:

Enables or disables error logging to disk.

Usage:

SetLogMode(1);

 

 

Team LRN

716 Appendix A The Torque Game Engine Reference

SetModPaths(path)

Parameters:

path

String containing path.

Return:

nothing

 

Description:

Set Mod path. This specifies which folders will be visible to the scripts and the

 

resource engine.

 

Usage:

SetModPaths("common;game");

SetNetPort(port)

Parameters:

port

Port number.

Return:

numeric

1 = success, 0 = fail.

Description:

Sets the network port.

Usage:

%result = SetNetPort(1313);

SetNPatch(switch, level)

Parameters:

switch

1 enables, 0 disables.

 

level

Target level.

Return:

nothing

 

Description:

Enables or disables Npatching (quadratic interpolation) at specified level.

Usage:

SetNPatch(1, 1);

 

SetOpenGLAnisotropy(level)

Parameters:

level

0=trilinear, 1=bilinear.

Return:

nothing

 

Description:

Sets the level of anisotropy.

Usage:

SetOpenGLAnisotropy(0);

SetOpenGLInteriorMipReduction(level)

Parameters:

level

Mipmap level (0 = minimum detail, 5 = maximum detail).

Return:

nothing

 

Description:

Sets interior texture detail.

Usage:

SetOpenGLInteriorMipReduction(2);

Team LRN

 

 

 

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);

 

 

 

 

 

 

 

 

SetOpenGLTextureCompressionHint(hint)

 

 

 

Parameters:

hint

The compression level hint. Choices:

 

 

 

 

GL_DONT_CARE

 

 

 

 

GL_FASTEST

 

 

 

 

GL_NICEST

 

 

Return:

nothing

 

 

 

 

Description:

Suggests texture compression mode.

 

 

Usage:

SetOpenGLTextureCompressionHint(GL_NICEST);

 

 

 

 

 

 

 

 

 

 

 

 

 

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.

 

 

 

subst

Substitute string.

 

 

Return:

string

The resultant string.

 

 

Description:

Substitutes the record-string sub for the record-string found at index in the string

 

 

 

text.

 

 

 

 

Usage:

%str = SetRecord(%text, 0, "blah");

 

 

 

 

 

 

 

Team LRN