Lua/Kart/Global Variables and Constants

From SRB2 Wiki
Jump to navigation Jump to search
This article is a stub. It already has some of the necessary information on this topic, but it could be expanded upon. You can help the SRB2 Wiki and its users by expanding it!

This page gathers all Lua global variables and constants that are specific to SRB2Kart, or differ from SRB2 v2.1's default functionality. For further reading on how these work, please see their respective global variables and constants pages.

Global variables

Name Variable type Description
majormods boolean Returns true if modifications, such as characters, are loaded that do not include Lua.
gamespeed integer 0 means Easy speed, 1 means Normal speed, and 2 means Hard speed.
encoremode boolean Returns true if a level is being played as its Encore variant.
fracticitems boolean Returns true if Frantic Items are enabled.
comeback boolean Returns true if Karma Comeback in Battle is enabled.
wantedcalcdelay tic_t Returns the time, in tics, before the Wanted player in Battle gets recalculated.
indirectitemcooldown tic_t Returns the cooldown, in tics, until the Self-Propelled Bomb and Shrink can be rolled again.
hyubgone tic_t Returns the cooldown, in tics, until a Hyuudoro can be rolled again.
thwompsactive boolean Returns true if thwomps are active in a level that feature them.
spbplace integer Returns the player number of the player being chased down by the Self-Propelled Bomb.
mapobjectscale fixed_t Returns the mobjscale set in the map header of the current level.
numlaps integer Returns the number of laps in the current race.
racecountdown tic_t Returns the time left, in tics, until the race is considered finished. Those still racing will blow up when the time is up.
exitcountdown tic_t Returns the time left, in tics, until the game goes into its results or intermission screen.
replayplayback boolean Returns true if a replay is being viewed.

Constants

Button Flags

Decimal Hexadecimal Flag name Description
1 0x01 BT_ACCELERATE Accelerate.
4 0x04 BT_DRIFT Drift.
8 0x08 BT_BRAKE Brake.
16 0x10 BT_ATTACK Use item.
32 0x20 BT_FORWARD Aim item forward.
64 0x40 BT_BACKWARD Aim item backward.
8196 0x2000 BT_CUSTOM1 Custom Action 1
16384 0x4000 BT_CUSTOM2 Custom Action 2
32768 0x8000 BT_CUSTOM3 Custom Action 3

Kart Items

Decimal Name Description
-1 KITEM_SAD Invalid item.
0 KITEM_NONE No item.
1 KITEM_SNEAKER Sneaker.
2 KITEM_ROCKETSNEAKER Rocket Sneakers.
3 KITEM_INVINCIBILITY Invincibility.
4 KITEM_BANANA Banana.
5 KITEM_EGGMAN Eggman.
6 KITEM_ORBINAUT Orbinaut.
7 ITEM_JAWZ Jawz.
8 KITEM_MINE Mine.
9 KITEM_BALLHOG Ballhog.
10 KITEM_SPB Self-Propelled Bomb.
11 KITEM_GROW Grow.
12 KITEM_SHRINK Shrink.
13 KITEM_THUNDERSHIELD Thunder Shield.
14 KITEM_HYUDORO Hyuudoro.
15 KITEM_POGOSPRING Pogo Spring.
16 KITEM_KITCHENSINK Kitchen Sink.
17 NUMKARTITEMS Total number of individual items.
17 KRITEM_TRIPLESNEAKER Triple Sneaker. Used exclusively for K_GetItemPatch in Lua.
18 KRITEM_TRIPLEBANANA Triple Banana. Used exclusively for K_GetItemPatch in Lua.
19 KRITEM_TRIPLEORBINAUT Triple Orbinaut. Used exclusively for K_GetItemPatch in Lua.
20 KRITEM_QUADORBINAUT Quad Orbinaut. Used exclusively for K_GetItemPatch in Lua.
21 KRITEM_DUALJAWZ Dual Jawz. Used exclusively for K_GetItemPatch in Lua.
22 NUMKARTRESULTS Total number of roulette items.
  Lua [view]
Language features SyntaxMetatables
SRB2 data ActionsConstantsFunctionsGlobal variablesHooksUserdata structures
SRB2Kart data Kart Userdata structuresKart FunctionsKart HooksKart Global Variables and Constants
Tutorials Freeslots and Object resourcesCustom player ability