Hook list
start() client-side server-side
# Runs on every game start, thus after every round
public action start() {
}
1
2
3
4
2
3
4
update() client-side server-side
# 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
render() client-side
# 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
onPlayerSpawn() client-side server-side
# Runs when player spawns in
public action onPlayerSpawn(str id) {
# str id - player id
}
1
2
3
4
2
3
4
onPlayerUpdate() client-side server-side
# 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
onPlayerDeath() client-side server-side
# 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
onPlayerDamage() server-side
# 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
onPlayerLeave() server-side
# 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
onGameEnd() server-side
# Runs when the game ends
public action onGameEnd() {
}
1
2
3
4
2
3
4
onChatMessage() server-side
# 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
onServerClosed() server-side
# Runs when the server closes
public action onServerClosed() {
}
1
2
3
4
2
3
4
onAdFinished() server-side
# 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
onMouseClick() client-side
# 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
onMouseUp() client-side
# 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
onMouseScroll() client-side
# 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
onKeyPress() client-side
# 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
onKeyUp() client-side
# 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
onMouseScroll() client-side
# 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
onNetworkMessage() client-side server-side
# 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
onCustomTrigger() server-side
# 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
onDIVClicked() client-side
# Runs when div is clicked
public action onDIVClicked(str id) {
# str divid - element id
}
1
2
3
4
2
3
4
onControllerPress() client-side
# 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
onControllerUp() client-side
# 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
onControllerHeld() client-side
# 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