Skip to reading
Save Games & Inventory

Lua and BASIC use the shared actions too

Edition 0.86.4.1 HF1

0.86.4.1 Hotfix 1 edition. Earlier lessons and screenshots retain their original version context; revised references and supplements describe the newer behavior.

Download PDFView PDF page

A Lua record returns a module table. This complete record dispatches Load selected:

Code example
local Script = {}
Code example
function Script.run(context)
    await(SaveGameWidgetCommand({
        guiId = "save_lab",
        elementId = "save_slots",
        command = "load-selected",
        slot = -1
    }))
    return true
end
Code example
return Script

The equivalent BASIC record uses a Run function and a dictionary:

Code example
OPTION PCA3D BASIC 1.0
Code example
FUNCTION Run(context AS Dictionary)
    DIM options = {"guiId": "save_lab", "elementId": "save_slots"}
    options["command"] = "load-selected"
    options["slot"] = -1
    AWAIT SaveGameWidgetCommand(options)
    RETURN TRUE
END FUNCTION

These are command-dispatch examples. Add a selected-slot/file-existence check when your surrounding UI needs one. Keep slot values numerical; a name such as checkpoint_1 is not a numbered slot.

Page 89 of 96Permalink
Go to page