Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.pullEvent = os.pullEventRaw
- local tChoices = {}
- tChoices[0] = 'Locking Wizard'
- tChoices[1] = 'Reserved'
- tChoices[2] = 'Reserved'
- tChoices[3] = 'Reserved'
- table.insert(tChoices, 'Exit')
- local nTermX, nTermY = term.getSize()
- local sSeperator = ("-"):rep(nTermX)
- local tActions = {}
- tActions[0] = function()
- term.clear()
- term.setCursorPos(1, 1)
- write("Starting Locking Wizard")
- write('\n')
- write("Coded By resaloli")
- term.setCursorPos(nTermX / 2, nTermY)
- write(" [Press enter to start]")
- read()
- shell.run("/disk/wizard")
- end
- tActions[1] = function()
- term.clear()
- term.setCursorPos(1, 1)
- print("Nothing yet!")
- write(" [Press enter to return to main menu]")
- read()
- end
- tActions[2] = function()
- term.clear()
- term.setCursorPos(1, 1)
- print("Nothing yet!")
- write(" [Press enter to return to main menu]")
- read()
- end
- tActions[3] = function()
- term.clear()
- term.setCursorPos(1, 1)
- print("Nothing yet!")
- write(" [Press enter to return to main menu]")
- read()
- end
- table.insert(tActions, os.reboot)
- local nSelection = 0
- while true do
- term.setCursorPos(1, 1)
- term.clear()
- print(sSeperator)
- print("| Resaloli simple GUI |")
- print(sSeperator)
- for nLine = 0, #tChoices do
- local sLine = " "
- if nSelection == nLine then
- sLine = ">"
- end
- local sLineNum = tostring(nLine)
- if #sLineNum < 2 then
- sLineNum = sLineNum
- end
- sLine = sLine .. "[" .. sLineNum .. "]" .. " " .. tChoices[nLine]
- print(sLine)
- end
- local sEvent, nKey = os.pullEvent("key")
- if nKey == 200 or nKey == 17 then
- if tChoices[nSelection - 1] then
- nSelection = nSelection - 1
- end
- elseif nKey == 208 or nKey == 31 then
- if tChoices[nSelection + 1] then
- nSelection = nSelection + 1
- end
- elseif nKey == 28 then
- if tActions[nSelection] then
- tActions[nSelection]()
- else
- print("Error: Selection out of bounds: ", nSelection)
- read()
- end
- end
- end
Add Comment
Please, Sign In to add comment