| Revision as of 14:31, 3 March 2009 Gcamp (Talk | contribs) s3d.get_tank ← Previous diff |
Current revision Gcamp (Talk | contribs) s3d.get_option |
||
| Line 8: | Line 8: | ||
| Returns the current value for the given scorched3d game option. | Returns the current value for the given scorched3d game option. | ||
| Example: s3d.get_option("NoMaxPlayers") would return the maximum number of players allowed in the game. All of the possible values for optionName can be found in the ''server.xml'' file. | Example: s3d.get_option("NoMaxPlayers") would return the maximum number of players allowed in the game. All of the possible values for optionName can be found in the ''server.xml'' file. | ||
| + | |||
| + | ;As of version 42.1 this can also return the transient options for the current game. | ||
| + | :CurrentRoundNo | ||
| + | :CurrentGameNo | ||
| + | :WindAngle | ||
| + | :WindSpeed | ||
| + | :WindDirection | ||
| + | :WallType | ||
| + | Example: s3d.get_option("CurrentRoundNo") would return current round number. | ||
| ===s3d.get_tank=== | ===s3d.get_tank=== | ||
Contents |
The Scorched3D library is a LUA library that implements a set of general purpose Scorched3D functions. All of the functions have the s3d prefix i.e. use s3d.functionname to call them.
s3d.get_option(string optionName)
Returns the current value for the given scorched3d game option. Example: s3d.get_option("NoMaxPlayers") would return the maximum number of players allowed in the game. All of the possible values for optionName can be found in the server.xml file.
Example: s3d.get_option("CurrentRoundNo") would return current round number.
s3d.get_tank(integer playerid)
Returns a table containing details for the given tank/player. This table is defined as follows:
{
name, -- a string name of the tank
id, -- an integer playerid of the tank
position, -- a table containing x,y,z indicating the position of this tank
alive, -- a boolean representing the current state of the tank
team -- an integer representing the team of the tank,
money -- an integer representing the money of the tank,
score -- an integer representing the score of the tank,
rank -- an integer representing the rank of the tank,
skill -- an integer representing the skill of the tank,
lives -- an integer representing the remaining lives of the tank
}
s3d.get_tanks()
Returns a table containing details for ALL tanks/players. This table is defined as follows
{
<playerid> -- a table containing the tank information (see above)
}
Note: <playerid> is the actual integer id of the tank. You can think of the returned table as an map of playerid to tank details.
s3d.get_height(number x, number y)
Returns a number representing the landscape height at the requested x and y position.
s3d.get_arenawidth() s3d.get_arenaheight()
Returns a number representing the width or height of the current playable arena area.
s3d.get_landscapewidth() s3d.get_landscapeheight()
Returns a number representing the width or height of the total landscape area.