EGGOXdevelopers

Room events

Event Handler arguments and meaning --- --- start function() once when the copy starts, before players enter enter function(player) when someone joins leave fu

EventHandler arguments and meaning
startfunction() once when the copy starts, before players enter
enterfunction(player) when someone joins
leavefunction(player) when someone leaves
clickfunction(player, thing) after the player reaches the clicked thing
walk_onfunction(player, thing) when stepping onto a visible thing
walk_offfunction(player, thing) when stepping off
timerfunction(tag) for an after or every timer
keyfunction(player, key) for game keys such as space, w, up, 1
uifunction(player, id, value) for a button, submitted input or selected friend
window_closedfunction(player, id) when the player clicks the native window X
send_failedfunction(player, room, why) when a scripted room transfer fails

player contains id and name. thing contains id, name, x, y, hidden, and item (the id of the item it is an instance of). Most object/player arguments accept a table or its id string; use the player table for overloaded UI verbs such as banner(player, text). players() additionally provides player x and y. player(idOrPlayer) returns the current row for just one player in this copy, or nil if absent. Use that when updating a bounded group in a large room, to avoid constructing a Lua table for everyone on each tick. Coordinates are tiles local to the room, starting at (0, 0).

This page as markdown: /api/room-events.md