TorqueScript Reference
Functions

Functions

void cancelServerQuery ()
 
int getServerCount ()
 
void queryLanServers (port, flags, gametype, missiontype, minplayers, maxplayers, maxbots, regionmask, maxping, mincpu, filterflags)
 
void queryMasterServer (flags, gametype, missiontype, minplayers, maxplayers, maxbots, regionmask, maxping, mincpu, filterflags)
 
void querySingleServer (address[, flags])
 
Boolean setServerInfo (index)
 
void startHeartbeat ()
 
void stopHeartbeat ()
 
void stopServerQuery ()
 

Detailed Description

Function Documentation

◆ cancelServerQuery()

void cancelServerQuery ( )

Use the cancelServerQuery function to cancel a previous query*() call.

Returns
No return value.
See also
queryLANServers, queryMasterServer, querySingleServer

◆ getServerCount()

int getServerCount ( )

Use the getServerCount function to determine the number of game servers found on the last queryLANServers() or queryMasterServer() call. This value is important because it allows us to properly index when calling setServerInfo().

Returns
Returns a numeric value equal to the number of game servers found on the last queryLANServers() or queryMasterServer() call. Returns 0 if the function was not called, or none were found.
See also
queryLANServers, queryMasterServer, setServerInfo

◆ queryLanServers()

void queryLanServers ( port  ,
flags  ,
gametype  ,
missiontype  ,
minplayers  ,
maxplayers  ,
maxbots  ,
regionmask  ,
maxping  ,
mincpu  ,
filterflags   
)

Use the queryLANServers function to establish whether any game servers of the required specification(s) are available on the local area network (LAN).

Parameters
portLook for any game servers advertising at this port. Set to 0 if you don't care what port the game server is using.
flagsLook for any game servers with these special flags set. Set to 0 for no flags.
gametypeLook for any game servers playing a game type that matches this string. Set to the NULL string to look for any game type.
missiontypeLook for any game servers playing a mission type that matches this string. Set to the NULL string to look for any mission type.
minplayersLook for any game servers with this number of players or more. Set to 0 for no lower limit.
maxplayersLook for any game servers with this number of players or fewer. Set to 0 for no upper limit.
maxbotsLook for any game servers with this number of AI controlled players or fewer. Set to 0 for no limit.
regionmaskLook for any master servers, on our master server list, in this region. Set to 0 to examine all regions.
maxpingLook for any game servers with a PING rate equal to or lower than this. Set to 0 for no upper PING limit.
mincpuLook for any game servers with a CPU (clock speed) equal or greater than this. Set to 0 for no CPU (clock speed) limit.
filterflagsLook for any game servers with this game version number or higher. Set to 0 to find all versions.
Returns
No return value.
See also
getServerCount, queryMasterServer, setServerInfo, stopServerQuery

◆ queryMasterServer()

void queryMasterServer ( flags  ,
gametype  ,
missiontype  ,
minplayers  ,
maxplayers  ,
maxbots  ,
regionmask  ,
maxping  ,
mincpu  ,
filterflags   
)

Use the queryMasterServer function to query all master servers in the master server list and to establish if they are aware of any game servers that meet the specified requirements, as established by the arguments passed to this function. In order for this function to do anything, a list of master servers must have been previously specified. This list may contain one or more server addresses. A call to this function will search all servers in the list. To specify a list, simply create a set of array entries like this:$pref::Master[0] = \2:192.168.123.15:28002\;$pref::Master[1] = \2:192.168.123.2:28002\;The format of these values is ==> Region Number : IP Address : Port NumberThese values should be specified in either the client's or the server's preferences file (prefs.cs). You may specifiy it elsewhere, however be sure that it is specified prior to this function being called and before any other functions that rely on it.

Parameters
flagsLook for any game servers with these special flags set. Set to 0 for no flags.
gametypeLook for any game servers playing a game type that matches this string. Set to the NULL string to look for any game type.
missiontypeLook for any game servers playing a mission type that matches this string. Set to the NULL string to look for any mission type.
minplayersLook for any game servers with this number of players or more. Set to 0 for no lower limit.
maxplayersLook for any game servers with this number of players or fewer. Set to 0 for no upper limit.
maxbotsLook for any game servers with this number of AI controlled players or fewer. Set to 0 for no limit.
regionmaskLook for any master servers, on our master server list, in this region. Set to 0 to examine all regions.
maxpingLook for any game servers with a PING rate equal to or lower than this. Set to 0 for no upper PING limit.
mincpuLook for any game servers with a CPU (clock speed) equal or greater than this. Set to 0 for no CPU (clock speed) limit.
filterflagsLook for any game servers with this game version number or higher. Set to 0 to find all versions.
Returns
No return value.
See also
getServerCount, queryLANServers, setServerInfo, startHeartbeat, stopServerQuery

◆ querySingleServer()

void querySingleServer ( address  [, flags])

Use the querySingleServer function to re-query a previously queried lan server, OR a game server found with queryLANServers or with queryMasterServer and selected with setServerInfo. This will refresh the information stored by TGE about this server. It will not however modify the values of the $ServerInfo::* global variables.

Parameters
addressThe IP address and Port to re-query, i.e. \192.168.123.2:28000.
flagsNo longer used.
Returns
No return value.
See also
getServerCount, queryLANServers, queryMasterServer, setServerInfo, stopServerQuery

◆ setServerInfo()

Boolean setServerInfo ( index  )

Use the setServerInfo function to set the values of the $ServerInfo::* global variables with information for a server found with queryLANServers or with queryMasterServer.

Parameters
indexThe index of the server to get information about.
Returns
Will return true if the information was successfully set, false otherwise.
See also
getServerCount, queryLANServers, queryMasterServer, querySingleServer

◆ startHeartbeat()

void startHeartbeat ( )

Use the startHeartbeat function to start advertising this game serer to any master servers on the master server list. In order for this function to do anything, a list of master servers must have been previously specified. This list may contain one or more server addresses. Once this function is called, the game server will re-advertise itself to all the master servers on its master server lits every two minutes. To specify a list, simply create a set of array entries like this:$pref::Master[0] = \2:192.168.123.15:28002\;$pref::Master[1] = \2:192.168.123.2:28002\;The format of these values is ==> Region Number : IP Address : Port NumberThese values should be specified in either the client's or the server's preferences file (prefs.cs). You may specifiy it elsewhere, however be sure that it is specified prior to this function being called and before any other functions that rely on it.

Returns
No return value.
See also
queryMasterServer, stopHeartbeat

◆ stopHeartbeat()

void stopHeartbeat ( )

Use the startHeartbeat function to stop advertising this game serer to any master servers on the master server list.

Returns
No return value.
See also
queryMasterServer, startHeartbeat

◆ stopServerQuery()

void stopServerQuery ( )

Use the stopServerQuery function to cancel any outstanding server queries.

Returns
No return value.
See also
queryLANServers, queryMasterServer, querySingleServer