Referência de funções
GameMaker Studio · GML · Setup & session
gmda_pollEvent
Returns the next queued result struct, or undefined when the queue is empty. Drain it in a loop each Step.
Synchronous (returns directly)
Signature
gmda_pollEvent() -> struct or undefinedWhat it does
Pops and returns the oldest queued result struct. Every struct has an event field (the event name) and, for the asynchronous calls, success plus the call-specific fields. This is the GameMaker stand-in for Godot's signals.
Parameters
This function takes no parameters.
How to call it
Call it in the controller Step event inside a while loop until it returns undefined, switching on e.event to react to each result.
Returns: The next result struct { event, success, ... }, or undefined when the queue is empty.
Example
var e = gmda_pollEvent();
while (!is_undefined(e)) {
switch (e.event) {
case "session_started": show_debug_message("hello " + e.player_name); break;
case "tables_loaded": show_debug_message("tables ready"); break;
case "error": show_debug_message("error in " + e.event_for + ": " + e.error); break;
}
e = gmda_pollEvent();
}Use cases
- React to session, leaderboard, player and other backend results.
- Centralize all asynchronous handling in one Step loop.