Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- selectedItem = 1
- pressedOkay = false
- local function userResponse()
- event, param1 = os.pullEvent("key")
- --down
- if param1 == 208 then
- selectedItem = selectedItem - 1
- --up
- elseif param1 == 200 then
- selectedItem = selectedItem + 1
- -- if they press enter
- elseif param1 == 28 then
- pressedOkay = true
- end
- -- loop
- if selectedItem == 3 then
- selectedItem = 1
- elseif selectedItem == 0 then
- selectedItem = 2
- end
- updating()
- end
- function updating()
- -- if we've chosen which to update
- if pressedOkay == true then
- if selectedItem == 1 then
- turtleUpdate()
- elseif selectedItem == 2 then
- computerUpdate()
- end
- end
- end
- function chooseUpdater()
- while not pressedOkay do
- term.clear() -- Clear the screen
- term.setCursorPos(1,1) -- Set the cursor pos
- print ("Which updater would you like to use?") -- Message to print above the menu
- print()
- print ("Controls:")
- print ("Arrow Keys to move up and down, Enter to select") -- Message to print above the menu
- print()
- if selectedItem == 1 then
- print("-Turtle Updater-") -- Text to show if the cursor is on the first choice
- print("Computer Updater")
- print()
- elseif selectedItem == 2 then
- print("Turtle Updater") -- Text to show if the cursor is on the second choice
- print("-Computer Updater-")
- print()
- end
- userResponse()
- end
- end
- function turtleUpdate()
- -- backwards compatible delete previous programs
- shell.run('delete startup')
- shell.run('delete excav')
- shell.run('delete bridge')
- shell.run('delete checkFuel')
- --delete ones in folders
- fs.delete('sp')
- --downloads updated files
- shell.run('pastebin get SatJv72h startup')
- shell.run('pastebin get hyFheSSf excav')
- shell.run('pastebin get ULK49FXh bridge')
- shell.run('pastebin get f7yDWLE5 checkFuel')
- shell.run('pastebin get TLLF4awU BENCH')
- -- move to folder
- shell.run('mkdir sp')
- shell.run('move checkFuel sp')
- shell.run('move excav sp')
- shell.run('move bridge sp')
- shell.run('move BENCH sp')
- end
- function computerUpdate()
- --delete ones in folders
- fs.delete('sp')
- --downloads updated files
- shell.run('delete startup')
- shell.run('pastebin get rPXXw0pn startup')
- shell.run('pastebin get Sc1mUb9f lockDoor')
- -- move to folder
- shell.run('mkdir sp')
- shell.run('move lockDoor sp')
- end
- chooseUpdater()
Advertisement
Add Comment
Please, Sign In to add comment