Advertisement
RobotBubble

ClickTurtleMenu2

Nov 8th, 2017
110
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. rednet.open("back")
  2.  
  3. local x, y = 1,4
  4. local x2, y2 = 1,6
  5. local x3, y3 = 1,8
  6. local x4, y4 = 1,10
  7. local x5, y5 = 1,12
  8. local x6, y6 = 1,14
  9. local x7, y7 = 1,16
  10. local choice1 = "[ ] Menu "
  11. local choice2 = "[ ] Remote "
  12. local choice3 = "[ ] Rename "
  13. local choice4 = "[ ] Refuel "
  14. local choice5 = "[ ] AutoFuel "
  15. local choice6 = "[ ] Restart "
  16. local choice7 = "[ ] Shutdown "
  17.  
  18. term.clear()
  19. term.setCursorPos(1, 1)
  20. term.setTextColor(colors.lightGray)
  21. print("--------------------------")
  22. print("---")
  23. term.setTextColor(colors.lightBlue)
  24. term.setCursorPos(4, 2)
  25. print("Bubble Bot Computers")
  26. term.setTextColor(colors.lightGray)
  27. term.setCursorPos(24, 2)
  28. print("---")
  29. print("--------------------------")
  30. local function drawMenu()
  31. sleep(.1)
  32. term.setCursorPos(x, y)
  33. term.setTextColor(colors.white)
  34. write(choice1)
  35. term.setCursorPos(x2, y2)
  36. write(choice2)
  37. term.setCursorPos(x3, y3)
  38. write(choice3)
  39. term.setCursorPos(x4, y4)
  40. write(choice4)
  41. term.setCursorPos(x5, y5)
  42. write(choice5)
  43. term.setCursorPos(x6, y6)
  44. write(choice6)
  45. term.setCursorPos(x7, y7)
  46. write(choice7)
  47. end
  48.  
  49. drawMenu()
  50.  
  51. while true do
  52. local event, button, cx, cy = os.pullEvent()
  53. if event == "mouse_click" then
  54. if cx >= x and cx < choice1:len() and cy == y and button == 1 then
  55. term.clear()
  56. term.setCursorPos(1, 1)
  57. term.setTextColor(colors.white)
  58. shell.run("menu")
  59. elseif cx >= x2 and cx < choice2:len() and cy == y2 and button == 1 then
  60. term.clear()
  61. term.setCursorPos(1, 1)
  62. term.setTextColor(colors.white)
  63. shell.run("remote")
  64. elseif cx >= x3 and cx < choice3:len() and cy == y3 and button == 1 then
  65. rednet.broadcast("TurtleName")
  66. sleep(1)
  67. term.clear()
  68. term.setCursorPos(1, 1)
  69. print("Name:")
  70. term.setCursorPos(6, 1)
  71. input = read()
  72. sleep(3)
  73. rednet.broadcast(input)
  74. sleep(2.5)
  75. shell.run("turtlemenu")
  76. elseif cx >= x4 and cx < choice3:len() and cy == y4 and button == 1 then
  77. rednet.broadcast("TS Refuel")
  78. sleep(.1)
  79. shell.run("turtlemenu")
  80. elseif cx >= x5 and cx < choice3:len() and cy == y5 and button == 1 then
  81. term.clear()
  82. term.setCursorPos(1, 1)
  83. print("Turning ON autofuel")
  84. print("on remote startup")
  85. sleep(3)
  86. shell.run("delete remote")
  87. shell.run("delete remote2")
  88. shell.run("pastebin get f39FWPcg remote")
  89. shell.run("pastebin get tVYXJMaY remote2")
  90. shell.run("delete turtlemenu")
  91. shell.run("pastebin get HuZxiUFC turtlemenu")
  92. sleep(2.5)
  93. os.reboot()
  94. elseif cx >= x6 and cx < choice3:len() and cy == y6 and button == 1 then
  95. rednet.broadcast("TurtleRestart")
  96. elseif cx >= x7 and cx < choice3:len() and cy == y7 and button == 1 then
  97. rednet.broadcast("TurtleShutdown")
  98. sleep(1)
  99. shell.run("menu")
  100. end
  101. break
  102. end
  103. end
Advertisement
RAW Paste Data Copied
Advertisement