Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Backing up and later retrieving the storage.* table of a console script.
- -- In the console script:
- function init()
- storage = console.configParameter("scriptStorage")
- end
- function syncStorage()
- world.callScriptedEntity(console.sourceEntity(), "onConsoleStorageRecieve", storage)
- end
- -----------------------------------------------------------------------------------
- -- In the object script:
- function onConsoleStorageRecieve(consoleStorage)
- storage.consoleStorage = consoleStorage
- end
- function onInteraction(args)
- local interactionConfig = {
- gui = {
- background = {
- zlevel = 0,
- type = "background",
- fileHeader = "/testconsole/consoleheader.png",
- fileBody = "/testconsole/consolebody.png"
- },
- scriptCanvas = {
- zlevel = 1,
- type = "canvas",
- rect = {40, 45, 434, 254},
- captureMouseEvents = true,
- captureKeyboardEvents = true
- },
- close = {
- zlevel = 2,
- type = "button",
- base = "/interface/cockpit/xup.png",
- hover = "/interface/cockpit/xdown.png",
- pressed = "/interface/cockpit/xdown.png",
- callback = "close",
- position = {419, 263},
- pressedOffset = {0, -1}
- }
- },
- scripts = {"/testconsole/testconsolegui.lua"},
- scriptDelta = 5,
- scriptCanvas = "scriptCanvas"
- }
- interactionConfig.scriptStorage = storage.consoleStorage
- return {"ScriptConsole", interactionConfig}
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement