Globals

Global functions accessed from every script.

Functions
.​getMap

Returns a handle to the current tilemap CMap.

Returns
CMap

the current map

.​getRules

Returns a handle to the current rules system CRules.

Returns
getRules

the current rules

.​getHUD

Returns a handle to the current HUD system <CHUD>.

Returns
getHUD

the current HUD

.​getNet

Returns a handle to the current network system <CNet>.

Returns
getNet

the network system

.​getSecurity

Returns a handle to the current security levels system <CSecurity>.

Returns
getSecurity

the security levels system

.​getCamera

Returns a handle to the current camera <CCamera>.

Returns
getCamera

the current camera

.​getControls`

Returns a handle to the current controls system <CControls>.

Returns
getControls

the current HUD

.​getDriver

Returns a handle to the current graphics driver system with access to rendering and screen capabilities <Driver>.

Returns
getDriver

the graphics driver

.​getPlayerCount

Return number of players.

Returns
s32

player count

.​getPlayerIndex

Return index of player in players list.

Returns
s32

player index

.​getPlayersNum_NotSpectator

Returns the amount of players not including ones that are in spectator team

Returns
s32

player count that are not in spectator team

.​getPlayer

Return the player with index of index.

Parameters
s32

index of player

Returns
CPlayer@

the player object

See also:

CPlayer

.​AddBot

Adds a bot player.

Parameters
const string

name of bot

Returns
CPlayer@

the bots player object

.​AddBot

Adds a bot player with specified team and class. Note that this is just stored in the CPlayer class, logic for spawning should be provided in script.

Parameters
const string

name of bot

const u8

team

const u8

class

Returns
CPlayer@

the bots player object

.​ShakeScreen

Shakes the screen for some amount of time.

Parameters
int

magnitude

int

time (in ticks)

Vec2f

position in world space

See also:

<Vec2f>

.​ShakeScreen

Shakes the screen for some amount of time (legacy)

Parameters
Vec2f

direction vector

int

time (in ticks)

Vec2f

position in world space

See also:

<Vec2f>

.​ShakeScreen2

Shakes the screen for some amount of time with constant magnitude within screen.

Parameters
Vec2f

direction vector

int

time (in ticks)

Vec2f

position in world space

See also:

<Vec2f>

.​SetScreenFlash

Flashes the screen with a color and fades out. When a screen flash is already occuring, calling SetScreenFlash will override the effect.  The alpha at any given time is basealpha * (1 - smoothstep(timesinceflashbegin / flashtime))

Parameters
u8

alpha at time 0

u8

red

u8

green

u8

blue

float

duration in seconds of the effect, i.e. after which the effect is completely gone. defaults to 0.75f seconds

.​registerScriptedCommand

Register a script command to be executed from the console

Parameters
const string &in

name of the command

const string &in

the full function signature to use; cant accept parameters currently.

const string &in

the script filename

const string &in

a description of its usage to b e preinted with /list

Returns
bool

if the registration was successful

.​registerScriptedCommand

Register a script command to be executed from the console

Parameters
const string &in

name of the command

const string &in

the full function signature to use; cant accept parameters currently.

const string &in

the script filename

Returns
bool

if the registration was successful

.​client_AddToChat

Adds a colored message to the chat box.

Parameters
string

the message

SColor

color

See also:

<SColor>

.​client_AddToChat

Adds a message to the chat box.

Parameters
string

the message

See also:

<SColor>

.​client_SendChat

Sends a message as the current player

Parameters
string

the message

int

the chat channel to send on (0=global, 1=team)

.​MessageBox

Shows a message box with some information.

Parameters
string

the message

bool

whether all GUI is blocked when displaying this message

.​MessageBox

Shows a message box with some information and an additional caption.

Parameters
string

window caption

string

the message

bool

whether all GUI is blocked when displaying this message

.​getTicksASecond

Returns the number of ticks (engine updates) during a second.

Returns
u32

number of ticks

.​server_DropCoins

Drops coins and syncs them to clients.

Parameters
Vec2f

the position in world space coordinates

int

amount of coins

Returns
u32

number of ticks

.​ExitToMenu

Exits game and returns to main menu.

.​getGameTime

Returns the number of ticks since game start.

Returns
u32

number of ticks

.​getTranslatedString

Get the string translated to the local locale (according to g_locale and the locale files)

Parameters
const string &in toBeTranslated

the string to translate

Returns
string

the translated string; can be unchanged if no match is found.