SHOW:
|
|
- or go back to the newest paste.
| 1 | - | term.clear() |
| 1 | + | function one() |
| 2 | - | term.setBackgroundColor(colors.black) |
| 2 | + | os.shutdown() |
| 3 | - | term.setTextColor(colors.white) |
| 3 | + | |
| 4 | - | term.setCursorPos(1,1) |
| 4 | + | function two() |
| 5 | - | local menuOptions = {"Shutdown", "Store", "Games", "Files", "Shell(CraftOS)", "Reboot", "Update"}
|
| 5 | + | shell.run("pastebin get vgmvimJB menu3")
|
| 6 | shell.run("menu3")
| |
| 7 | end | |
| 8 | function three() | |
| 9 | - | term.setCursorPos(termX/2-#text/2,termY) |
| 9 | + | |
| 10 | end | |
| 11 | - | return true |
| 11 | + | function four() |
| 12 | os.shutdown() | |
| 13 | end | |
| 14 | local menuOptions = {"shutdown", "More", "terug"}
| |
| 15 | - | term.clear() |
| 15 | + | |
| 16 | - | for i,v in ipairs(menuOptions) do |
| 16 | + | |
| 17 | - | if i == selected then |
| 17 | + | local strSeperator = string.rep(" ",5)
|
| 18 | - | centerText(":"..v..":", i)
|
| 18 | + | |
| 19 | - | else |
| 19 | + | term.setCursorPos(termX/2-#text/2, termY) |
| 20 | - | centerText(v,i) |
| 20 | + | |
| 21 | - | end |
| 21 | + | |
| 22 | function start() | |
| 23 | - | local id, key = os.pullEvent() |
| 23 | + | |
| 24 | - | if key == 208 and selected < #menuOptions then |
| 24 | + | term.clear() |
| 25 | local strMenuLine = "|" | |
| 26 | - | elseif key == 200 and selected > 1 then |
| 26 | + | for i,v in ipairs(menuOptions) do |
| 27 | if i == selected then | |
| 28 | strMenuLine = strMenuLine..strSeperator.."["..v.."]" | |
| 29 | - | local id, key = os.pullEvent() |
| 29 | + | else |
| 30 | - | if key == 28 then |
| 30 | + | strMenuLine = strMenuLine..strSeperator.." "..v.." " |
| 31 | end | |
| 32 | strMenuLine = strMenuLine..strSeperator.."|" | |
| 33 | end | |
| 34 | centerText("+"..string.rep("-",(#strMenuLine-2)).."+",1)
| |
| 35 | centerText(strMenuLine,2) | |
| 36 | centerText("+"..string.rep("-",(#strMenuLine-2)).."+",3)
| |
| 37 | - | if selected == 1 then |
| 37 | + | local id, key = os.pullEvent() |
| 38 | - | os.shutdown() |
| 38 | + | if id == "key" then |
| 39 | if key == 205 then | |
| 40 | - | if selected == 2 then |
| 40 | + | |
| 41 | - | shell.run("store")
|
| 41 | + | if selected > #menuOptions then |
| 42 | selected = 1 | |
| 43 | end | |
| 44 | - | if selected == 3 then |
| 44 | + | elseif key == 203 then |
| 45 | - | shell.run("games")
|
| 45 | + | |
| 46 | if selected < 1 then | |
| 47 | selected = #menuOptions | |
| 48 | - | if selected == 4 then |
| 48 | + | end |
| 49 | - | shell.run("files")
|
| 49 | + | elseif key == 28 then |
| 50 | return selected | |
| 51 | end | |
| 52 | - | |
| 52 | + | end |
| 53 | - | if selected == 5 then |
| 53 | + | |
| 54 | - | print("to go back, just type menu")
|
| 54 | + | |
| 55 | - | write("Command: ")
|
| 55 | + | |
| 56 | print() | |
| 57 | - | |
| 57 | + | if x == 1 then |
| 58 | - | if selected == 6 then |
| 58 | + | one() |
| 59 | - | os.reboot() |
| 59 | + | |
| 60 | if x == 2 then | |
| 61 | - | if selected == 7 then |
| 61 | + | two() |
| 62 | - | shell.run("update")
|
| 62 | + | |
| 63 | if x == 3 then | |
| 64 | three() | |
| 65 | end | |
| 66 | if x == 4 then | |
| 67 | four() | |
| 68 | end |