Computer_Craft_Coder

Untitled

May 19th, 2015
297
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. function newMenu()
  2. term.setCursorPos(1,1)
  3. print("Please make your selection now")
  4. term.setCursorPos(1,9)
  5. write("Selection: ")
  6. end
  7. function selection()
  8. print("1. Selection1")
  9. print("2. Selection2")
  10. --you can add more selections if you want
  11. term.setCursorPos(11,9) -- Resets the cursor back to the end of the selection line. Can be changed to any cursor position.
  12. end
  13. -- Now, the actual code
  14. term.clear()
  15. newMenu()
  16. selection()
  17. local input = read() --can add (*) if using passwords
  18. if input == "1" then --can also be anything else to designate the selection
  19. -- Do stuff here
  20. elseif input == "2" then
  21. --Do other stuff here
  22. else
  23. print("INVALID SELECTION. PLEASE TRY AGAIN")
  24. sleep(1)
  25. os.reboot() --only necessary if using this as a startup code.
  26. end
Add Comment
Please, Sign In to add comment