Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local PARAMPATH = "files/quarry"
- ---Loads a locally saved table and returns it
- ---@param path string a valid filepath
- ---@return table params or empty table
- local function loadParams(path)
- local file = fs.open(path, "r")
- if file ~= nil then
- local data = file.readAll()
- file.close()
- return textutils.unserialize(data)
- else
- return {}
- end
- end
- ---Saves the table at the defined path
- ---@param path string a valid filepath
- ---@param table table paramtable to save
- local function saveParams(path, table)
- local file = fs.open(path, "w")
- file.write(textutils.serialize(table))
- file.close()
- end
- local id = shell.openTab("con")
- multishell.setTitle(id, "controller")
- while true do
- local text = read()
- local params = loadParams(PARAMPATH)
- if text == "skip" then
- params.skip = true
- saveParams(PARAMPATH, params)
- print("skipping current...")
- sleep(2)
- elseif text == "skiprow" then
- params.skiprow = true
- saveParams(PARAMPATH, params)
- print("skipping current row...")
- sleep(2)
- elseif text == "stop" then
- params.stop = true
- saveParams(PARAMPATH, params)
- print("stopping progress on next level...")
- sleep(2)
- elseif text == "start" then
- params.stop = false
- saveParams(PARAMPATH, params)
- print("restarting...")
- sleep(2)
- end
- term.clear()
- term.setCursorPos(1, 1)
- end
Advertisement
Add Comment
Please, Sign In to add comment