Global Functions
Global functions are functions that are globally available to be called by any script.
This is a list of all of the global functions provided by the KAG application (that is, not defined in a script).
Function | Description |
---|---|
AddIconMarker |
This defines a token (e.g. $EmptyShop$) for icon replacement in menus and suchlike. |
AddColorMarker |
This defines a token (e.g. $RED$) for colouring text in menus and suchlike. |
CreateGridMenu |
Creates a CGridMenu with the given position on-screen, a reference to the owner blob, the grid dimensions and a caption. Returns a reference to the created CGridMenu. |
getPlayerByUsername |
Returns a reference to the CPlayer that has the given username, if one currently exists, otherwise it returns null. |
AddBot |
Adds a bot to the game, with the given name. Returns a reference to the bot's CPlayer object. |
Play |
Plays the a sound file at the given position (position used to determine if it can be heard). |
Players | |
getLocalPlayer |
Returns the CPlayer reference of the local CPlayer. |
Blobs | |
CreateBlob |
Creates a CBlob with the given factory and the given path to a config file defining the CBlob. Returns a reference to the created CBlob. |
getBlob |
Returns a reference to the CBlob with the given index in the list of blobs that currently exist. |
getPlayingBlob |
Returns a reference to the CBlob with the given index in the list of blobs that are currently active - i.e. not settled map blocks or in inventories. |
getBlobByNetworkId |
Returns a reference to the CBlob with the given Network ID. |
getBlobByName |
Returns a reference to the first CBlob with the given name. Probably not very useful. |
populateBlobsByNameList |
Populates the 'Blobs By Name List' with all of the CBlobs that currently exist with the given name. |
getBlobsByNameListBlob |
Returns a reference to a CBlob from the 'Blobs By Name List' with the given index in the list. |
getBlobsByNameListSize |
Returns the number of CBlobs in the 'Blobs By Name List'. |
getPlayingBlobsSize |
Returns the number of CBlobs that are currently active and in play - i.e. not settled map blocks or in inventories. |
getBlobSize |
Returns the number of CBlobs that currently exist. |
Inventory | |
AddRequirement |
Pushes the given requirements to a CBitStream, to be read by other requirement methods. |
ReadRequirement |
Reads requirements from the given CBitStream into variables you provide. |
hasRequirements |
Checks 1 or 2 inventories to see if they have the given requirements, and writes any missing requirements into a given CBitStream. Returns true if the requirements are met, otherwise false. |
TakeRequirementsCombined |
Removes the requirements in the given CBitStream from one of the CInventorys passed to it. |
GUI | |
LoadSkin |
Loads a skin config file. See GUI/guiSkin.cfg for example file. |
DrawPane |
Draws a pane with a shape specified by the given rect. |
DrawSunkenPane |
Draws a sunken pane with a shape specified by the given rect. |
DrawWindow |
Draws a window with a shape specified by the given rect. |
DrawFramedPane |
Draws a framed pane with a shape specified by the given rect. |
DrawButton |
Draws a button with a shape specified by the given rect. |
DrawButtonPressed |
Draws a pressed button with a shape specified by the given rect. |
DrawButtonHover |
Draws a hover-highlighted button with a shape specified by the given rect. |
DrawRectangle |
Draws a rectangle with a shape specified by the given rect. |
DrawProgressBar |
Draws a progress bar with a shape specified by the given rect and a given % fill. |
DrawIconByName |
Draws an icon added by AddIconToken using its token name. |
DrawIcon |
Draws an icon from the given file. |
DrawText |
Draws some text. |
Maths | |
Cos |
Returns the cosine of the given angle in radians. |
FastCos |
Returns the cosine of the given angle in radians. Faster, less reliable version. |
ACos |
Returns the arc cosine of the given angle in radians. |
Sin |
Returns the sine of the given angle in radians. |
FastSin |
Returns the sine of the given angle in radians. Faster, less reliable version. |
ASin |
Returns the arc sine of the given angle in radians. |
Tan |
Returns the tangent of the given angle in radians. |
ATan |
Returns the arc tangent of the given angle in radians. |
Pow |
Returns base raised to the power exponent. |
Sqrt |
Returns the square root of x. |
InvSqrt |
Returns the inverse square root of x. |
isValid |
Returns true if the given float is a valid number (not NaN or infinity) or not. |
Floor |
Returns the largest integral value that is not greater than the given number. |
Ceil |
Returns the smallest integral value that is not less than the given number. |
Equals |
Returns true if the two given floats are equal, otherwise false. |
Min |
Returns the smaller of the two given numbers. |
Max |
Returns the larger of the two given numbers. |
Abs |
Returns the absolute value of the given number. |
FMod |
Returns the floating-point remainder of the given numerator divided by the given denominator. |
Round |
Rounds the given float to the nearest whole number, as an int. |
Roundf |
Rounds the given float to the nearest whole number, as a float. |
Random |
Returns a pseudo-random int in the range 0 to the given max int. |
FastRandom |
Returns a seemingly-random (much less random than Random, though it is faster) int in the range 0 to the given max int. |
Strings | |
formatInt |
Returns a formatted string representation of the given int. |
formatFloat |
Returns a formatted string representation of the given float. |
parseInt |
Returns an int from the given string representation of an int. |
parseFloat |
Returns a double from the given string representation of an float. |
Printing | |
Prints the given text - to the console, if its available. | |
printInt |
Prints the given integer with the given prefix text - to the console, if its available. |
printFloat |
Prints the given float with the given prefix text - to the console, if its available. |
printString |
Prints the given string with the given prefix text - to the console, if its available. |
printVec2f |
Prints the given Vec2f with the given prefix text - to the console, if its available. |
printBool |
Prints the given bool with the given prefix text - to the console, if its available. |
printPos |
Prints the given position2d with the given prefix text - to the console, if its available. |
error |
Prints an error with the given text - to the console, if its available. |
warning |
Prints a warning with the given text - to the console, if its available. |
World | |
LoadRules |
Loads the given rules config file. |
LoadMap |
Loads the given map file. |
LoadNextMap |
Loads the next map in the map cycle. |
LoadMapCycle |
Loads the given map cycle file. |
LoadSeclevs |
Loads the given seclev config file. |
getGameTime |
Returns the game time (number of ticks) as an integer (s32). |
getFontHeight |
Returns the font height as an integer (s32). |
getScreenHeight |
Returns the screen height as an integer (s32). |
getScreenWidth |
Returns the screen width as an integer (s32). |
isPlayerListShowing |
Returns true if the player list/scoreboard is showing, otherwise false. |
drawRulesFont |
Draws the given text with the given colour, position and alignment. |
setHelpText |
Sets the help text to the given string (I think its the text that shows above your head - like 'press E to buy bomb' or whatever) |
getTicksASecond |
Returns the number of ticks per second. |
Singletons | |
getMap |
Returns a reference to the CMap object. |
getRules |
Returns a reference to the CRules object. |
getRespawn |
Returns a reference to the CRespawn object. |
getHUD |
Returns a reference to the CHUD object. |
getNet |
Returns a reference to the CNet object. |
getSecurity |
Returns a reference to the CSecurity object. |
getCamera |
Returns a reference to the CCamera object. |
getControls |
Returns a reference to the CControls object. |
getDriver |
Returns a reference to the Driver object. |
Particles | |
MakeCoin |
Creates a coin with a given position on-screen, velocity and a style. |
ParticleAnimated |
Creates a particle with a number of different options. |
ParticlePixel | ParticlePixel |
ParticleBlood | ParticleBlood |
ParticleSpark | ParticleSpark |
ParticleBloodSplat | ParticleBloodSplat |
ParticleZombieLightning | ParticleZombieLightning |