Hook list
client-side server-side
start()# Runs on every game start, thus after every round
public action start() {
}
1
2
3
4
2
3
4
client-side server-side
update()# Runs every tick, used for updating the world, players and AI
public action update(num delta) {
# num delta - time since last update in miliseconds
}
1
2
3
4
2
3
4
client-side
render()# Updates every tick, primarily used for updating the 2d canvas
public action render(num delta) {
# num delta - time since last update in miliseconds
}
1
2
3
4
2
3
4
client-side server-side
onPlayerSpawn()# Runs when player spawns in
public action onPlayerSpawn(str id) {
# str id - player id
}
1
2
3
4
2
3
4
client-side server-side
onPlayerUpdate()# Runs when player updates, useful for custom movement
public action onPlayerUpdate(str id, num delta, obj inputs) {
# str id - player id
# num delta - time since last update in miliseconds
# obj inputs - input object
}
1
2
3
4
5
6
2
3
4
5
6
client-side server-side
onPlayerDeath()# Runs when player dies
public action onPlayerDeath(str id, str killerID) {
#str id - id of dead player
#str killerID - id of killer
}
1
2
3
4
5
2
3
4
5
server-side
onPlayerDamage()# Runs when player receives damage
public action onPlayerDamage(str id, str doerID, num amount) {
#str id - id of player who got damaged
#str doerID - id of player who dealt the damage
#num amount - amount of damage dealt
}
1
2
3
4
5
6
2
3
4
5
6
server-side
onPlayerLeave()# Runs when a player disconnects from the server
public action onPlayerLeave(str playerID) {
#str playerID - id of player that left
}
1
2
3
4
2
3
4
server-side
onGameEnd()# Runs when the game ends
public action onGameEnd() {
}
1
2
3
4
2
3
4
server-side
onChatMessage()# Runs when a player sends a chat message
public action onChatMessage(str msg, str playerID) {
#str msg - message
#str playerID - player send id
}
1
2
3
4
5
2
3
4
5
server-side
onServerClosed()# Runs when the server closes
public action onServerClosed() {
}
1
2
3
4
2
3
4
server-side
onAdFinished()# Runs when a player finished watching an ad
public action onAdFinished(str playerID, bool success) {
# str playerID - Player who finished watching
# bool success - Whether the ad played succesfully
}
1
2
3
4
5
2
3
4
5
client-side
onMouseClick()# Runs when mouse clicked
public action onMouseClick(num button, num x, num y) {
# num button - mouse click button id (1: left mouse, 2: middle mouse, 3: right mouse, 4+: mouse macro's)
# num x - x position of mouse
# num y - y position of mouse
}
1
2
3
4
5
6
2
3
4
5
6
client-side
onMouseUp()# Runs after mouse click
public action onMouseUp(num button, num x, num y) {
# num button - mouse click button id (1: left mouse, 2: middle mouse, 3: right mouse, 4+: mouse macro's)
# num x - x position of mouse
# num y - y position of mouse
}
1
2
3
4
5
6
2
3
4
5
6
client-side
onMouseScroll()# Runs when mouse scrolls
public action onMouseScroll(num dir) {
# num dir - 1: scroll up, scroll left 2: scroll down, scroll right
}
1
2
3
4
2
3
4
client-side
onKeyPress()# Runs when mouse scrolls
public action onKeyPress(str key, num code) {
# str key - key in text format (space == " ")
# num code - code of key (space == 32)
}
1
2
3
4
5
2
3
4
5
client-side
onKeyUp()# Runs after key was pressed
public action onKeyUp(str key, num code) {
# str key - key in text format (space == " ")
# num code - code of key (space == 32)
}
1
2
3
4
5
2
3
4
5
client-side
onMouseScroll()# Runs when key is held
public action onKeyHeld(str key, num code) {
# str key - key in text format (space == " ")
# num code - code of key (space == 32)
}
1
2
3
4
5
2
3
4
5
client-side server-side
onNetworkMessage()# Receive message from server or client
public action onNetworkMessage(str id, obj data, str playerID) {
#str id - message name
#obj data - data as string
#str playerID - player id (server-side only)
}
1
2
3
4
5
6
2
3
4
5
6
server-side
onCustomTrigger()# Runs when trigger triggers "custom action" action
public action onCustomTrigger(str playerID, str customParam, num value) {
# str playerID - player id
# str customParam - custom trigger parameter
# num value - custom trigger value
}
1
2
3
4
5
6
2
3
4
5
6
client-side
onDIVClicked()# Runs when div is clicked
public action onDIVClicked(str id) {
# str divid - element id
}
1
2
3
4
2
3
4
client-side
onControllerPress()# Runs when a controller button gets pressed
public action onControllerPress(str key, num code) {
#str key - button in text format (dpad up == "dpad_up")
#num code - code of button (shoulder_bottom_left == 10003)
}
1
2
3
4
5
2
3
4
5
client-side
onControllerUp()# Runs when a controller button was pressed
public action onControllerUp(str key, num code) {
#str key - button in text format (dpad up == "dpad_up")
#num code - code of button (shoulder_bottom_left == 10003)
}
1
2
3
4
5
2
3
4
5
client-side
onControllerHeld()# Runs when a controller button is being held
public action onControllerHeld(str key, num code) {
#str key - button in text format (dpad up == "dpad_up")
#num code - code of button (shoulder_bottom_left == 10003)
}
1
2
3
4
5
2
3
4
5