Advertisement
FNCxPro

bootloader

Nov 6th, 2014
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.35 KB | None | 0 0
  1. local list1 = "CraftOS"
  2. local list1selected = true
  3. local list2 = "Reboot"
  4. local list2selected = false
  5. local list3 = "Shutdown"
  6. local list3selected = false
  7.  
  8. function redraw()
  9. term.setBackgroundColor(colors.white)
  10. term.setTextColor(colors.blue)
  11. term.clear()
  12. term.setCursorPos(1,1)
  13. print("ComputerCraft Universal Bootloader")
  14. term.setCursorPos(1,3)
  15. end
  16.  
  17. function countdown(startval)
  18. for i = 1, startval, -1 do
  19. term.clear()
  20. redraw()
  21. print("Computer is automatically starting in "..i)
  22. end
  23. end
  24.  
  25. function rawread()
  26. while true do
  27. local sEvent, param = os.pullEvent("key")
  28. if sEvent == "key" then
  29. if param == 208 then
  30. if list1selected == true then
  31. term.clear()
  32. redraw()
  33. list2selected = true
  34. list1selected = false
  35. elseif list2selected == true then
  36. term.clear()
  37. redraw()
  38. list1selected = true
  39. list2selected = false
  40. end
  41. elseif param == 200 then
  42. if list2selected == true then
  43. term.clear()
  44. redraw()
  45. list2selected = false
  46. list1selected = true
  47. elseif list3selected == true then
  48. term.clear()
  49. redraw()
  50. list3selected = false
  51. list2selected = true
  52. end
  53. elseif param == 28 then
  54. if list1selected == true then
  55.  
  56. term.clear()
  57. shell.run("shell")
  58. elseif list2selected == true then
  59.  
  60. os.reboot()
  61.  
  62. elseif list3selected == true then
  63. os.shutdown()
  64.  
  65. end
  66. end
  67. end
  68. end
  69.  
  70.  
  71. if list1selected == true then
  72. term.clear()
  73. redraw()
  74. term.setBackgroundColor(128)
  75. print(list1)
  76. term.setBackgroundColor(256)
  77. print(list2)
  78. print(list3)
  79. elseif list2selected == true then
  80. term.clear()
  81. redraw()
  82. term.setBackgroundColor(256)
  83. print(list1)
  84. term.setBackgroundColor(128)
  85. print(list2)
  86. term.setBackgroundColor(256)
  87. print(list3)
  88. elseif list3selected == true then
  89. term.clear()
  90. redraw()
  91. term.setBackgroundColor(256)
  92. print(list1)
  93. print(list2)
  94. term.setBackgroundColor(128)
  95. print(list3)
  96. end
  97. end
  98.  
  99. rawread()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement