Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[I would like to give credit and thanks to Dragon53535 for all this help!
- Thanks!]]--
- os.pullEvent = os.pullEventRaw
- local option = {[[|#################################################|
- | Quarry Management |
- | Status: ]],[[ |
- | |]],
- [[| |
- |#################################################|]],
- "| On |",
- "| Off |",
- "| >On |",
- "| >Off |"}
- local function clear(arg)
- if arg == 1 then
- term.setCursorPos(1,6)
- term.clearLine()
- term.setCursorPos(1,5)
- term.clearLine()
- print(option[6])
- write(option[5])
- elseif arg == 2 then
- term.setCursorPos(1,6)
- term.clearLine()
- term.setCursorPos(1,5)
- term.clearLine()
- print(option[4])
- write(option[7])
- end
- end
- function backon()
- if fs.exists("Settings") == true then
- main1()
- elseif fs.exists("Settings") == false then
- firsttimesetup()
- end
- end
- function firsttimesetup()
- fs.makeDir("Settings")
- local check = fs.open("Settings/Status","w")
- check.writeLine("Off")
- check.close()
- main1()
- end
- function main2(new)
- local x = 1
- term.clear()
- term.setCursorPos(1,1)
- write(option[1]..new)
- print(option[2])
- print(option[6])
- print(option[5])
- print(option[3])
- while true do
- local event, param1 = os.pullEvent("key")
- if param1 == 200 then
- clear(1)
- x = 1
- elseif param1 == 208 then
- clear(2)
- x = 2
- elseif param1 == 28 then
- if x == 2 then
- local file = fs.open("Settings/Status","w")
- file.writeLine("Off")
- file.close()
- main1()
- elseif x == 1 then
- local file = fs.open("Settings/Status","w")
- file.writeLine("On")
- file.close()
- main1()
- end
- end
- end
- end
- function main1()
- local file = fs.open("Settings/Status","r")
- local fileData = {}
- local line = file.readLine()
- repeat
- table.insert(fileData,line)
- line = file.readLine()
- until line == nil
- file.close()
- if fileData[1] == "On" then
- rs.setOutput("back",false)
- main2("On ")
- elseif fileData[1] == "Off" then
- rs.setOutput("back",true)
- main2("Off")
- end
- end
- backon()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement