Referência de funções
GameMaker Studio · GML · Cloud saves
gmda_loadGame
Loads the full data struct stored in a single cloud save slot.
Asynchronous (result via event)
Signature
gmda_loadGame(slot)What it does
POSTs /saves/load. An empty slot is NOT an error: save_loaded still fires with success=true and response = { save: undefined } (the JSON null maps to undefined in GML). When the slot is used, response.save is a struct { slot, data, updated_at } where response.save.data is your saved object verbatim. Test with is_struct(e.response.save) before reading it. Returns 0 immediately (no event) when there is no active session or slot is out of 1..10.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| slot | real | required | Save slot to load, 1 to 10. |
How to call it
Fire gmda_loadGame(), then read the result in a Step event with gmda_pollEvent() when e.event == "save_loaded".
Result event: save_loaded { success, response }
Example
gmda_loadGame(1);
// later, in a Step event:
var e = gmda_pollEvent();
while (!is_undefined(e)) {
if (e.event == "save_loaded") {
if (e.success && is_struct(e.response.save)) {
_apply_save(e.response.save.data);
} else {
_new_game();
}
}
e = gmda_pollEvent();
}Use cases
- Restore a player's progress on a Continue button.
- Detect a fresh player (response.save is undefined) and start a new game.