Bitfighter  021
The Bitfighter Lua Documentation - Robots, Levelgens, and Plugins
GameInfo Class Reference

Get information about the current game.

Member Functions

getEventScore(event)
 Get the value of a ScoringEvent.
 
getFlagCount()
 Get the number of flags in play. [details]
 
getGameTimeRemaining()
 Get the number of seconds until the game ends. [details]
 
getGameTimeTotal()
 Get the initial time limit of the game in seconds. [details]
 
getGameType()
 Get the GameType of the current game. [details]
 
getGameTypeName()
 Get a string representing the name of the game type. [details]
 
getLeadingScore()
 Get the highest score among all teams. [details]
 
getLeadingTeam()
 Get the index of the team with the highest score. [details]
 
getLevelName()
 Get a string representing the level's name. [details]
 
getNexusTimeLeft()
 The number of seconds until the nexus opens or closes. [details]
 
getPlayers()
 Get a list of the players in the game. [details]
 
getTeam(teamIndex)
 Get a Team by index. [details]
 
getTeamCount()
 Get the number of teams in the game. [details]
 
getWinningScore()
 Get the winning score. [details]
 
isNexusOpen()
 Get whether the nexus is open. [details]
 
isTeamGame()
 

Detailed Description

Get information about the current game.

You can get information about the current game with the GameInfo object. You only need get this object once, then you can use it as often as you like. It will always reflect the latest data. You can get this object with bf:getGameInfo() (see ScriptRunner::getGameInfo()).

Member Function Documentation

◆ getEventScore(event)

Arg types: event: ScoringEvent  |  returns int

Get the value of a ScoringEvent.

Returns
The number of points earned when the ScoringEvent event occurs, or zero if an unknown event is specified.

◆ getFlagCount()

returns int

Get the number of flags in play.

Returns
The number of flags in play.

◆ getGameTimeRemaining()

returns int

Get the number of seconds until the game ends.

Returns
The number of seconds until the game ends.

◆ getGameTimeTotal()

returns int

Get the initial time limit of the game in seconds.

Returns
The initial time limit of the game in seconds.

◆ getGameType()

returns GameType

Get the GameType of the current game.

For possible values, see GameType.

print(info:getGameType() == GameType.CTFGameType) -- true when playing CTF
GameType getGameType()
Get the GameType of the current game.
Definition: luaGameInfo__cpp.h:9
Returns
A member of GameType.

◆ getGameTypeName()

returns string

Get a string representing the name of the game type.

Returns
The name of the game type.

◆ getLeadingScore()

returns int

Get the highest score among all teams.

Returns
The highest score among all teams.

◆ getLeadingTeam()

returns int

Get the index of the team with the highest score.

Returns
The index of the team with the highest score.

◆ getLevelName()

returns string

Get a string representing the level's name.

Returns
A string representing the level's name.

◆ getNexusTimeLeft()

returns int

The number of seconds until the nexus opens or closes.

Returns
The number of seconds until the Nexus opens or closes, or nil if this is not a nexus game.

◆ getPlayers()

returns table

Get a list of the players in the game.

Returns
A table containing the PlayerInfo for each player (and robot) in the game

◆ getTeam(teamIndex)

Arg types: teamIndex: int  |  returns Team

Get a Team by index.

Note
Remember that Lua uses 1-based indices, so the index of the first team will be 1.
Returns
The Team with the specified index.

◆ getTeamCount()

returns int

Get the number of teams in the game.

Returns
The number of teams in the game.

◆ getWinningScore()

returns int

Get the winning score.

Returns
The number of flags in play.

◆ isNexusOpen()

returns bool

Get whether the nexus is open.

Returns
true if the Nexus is open during a Nexus game.

◆ isTeamGame()

returns bool
Returns
true if there is more than one team.