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
| Event | Handler arguments and meaning |
|---|---|
start | function() once when the copy starts, before players enter |
enter | function(player) when someone joins |
leave | function(player) when someone leaves |
click | function(player, thing) after the player reaches the clicked thing |
walk_on | function(player, thing) when stepping onto a visible thing |
walk_off | function(player, thing) when stepping off |
timer | function(tag) for an after or every timer |
key | function(player, key) for game keys such as space, w, up, 1 |
ui | function(player, id, value) for a button, submitted input or selected friend |
window_closed | function(player, id) when the player clicks the native window X |
send_failed | function(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