Advertisement
asteroidsteam

---

Sep 22nd, 2016
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. local function rujos()
  2. term.clear()
  3. term.setCursorPos(1,1)
  4. print 'Booting J:OS 1.7 Beta'
  5. sleep(1)
  6. end
  7.  
  8. local function bootcraft()
  9. term.clear()
  10. term.setCursorPos(4,4)
  11. print 'booting CraftOS 1.7'
  12. sleep(1)
  13. end
  14.  
  15. local function rejos()
  16. term.clear()
  17. term.setCursorPos(1,1)
  18. print 'Removing J:OS 1.7 Beta'
  19. sleep(1)
  20. end
  21.  
  22. local w,h = term.getSize()
  23. local options = {
  24. {'Run-J:OS',4,4,rujos};
  25. {'Boot-CraftOS',4,5,bootcraft};
  26. {'Remove-J:OS',4,5,rejos};
  27. }
  28.  
  29. local selection = 1
  30.  
  31. while true do
  32. term.clear()
  33.  
  34. for i, option in pairs(options) do
  35. if selection == i then
  36. term.setCursorPos(option[2] - 2, option[3])
  37. write '['
  38. term.setCursorPos(option[2] + #option[1] + 1, option[3])
  39. write ']'
  40. end
  41.  
  42. term.setCursorPos(option[2], option[3])
  43. write(option[1])
  44. end
  45.  
  46. local _, k = os.pullEvent('key')
  47. if k == keys.down then
  48. selection = (selection < #options)
  49. and selection + 1
  50. or 1
  51. elseif k == keys.up then
  52. selection = (selection > 1)
  53. and selection - 1
  54. or #options
  55. elseif k == keys.enter then
  56. local o = options[selection]
  57. local res = o[4] and o[4]() or true
  58. if res == false then
  59. break
  60. end
  61. end
  62. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement