Advertisement
RobotBubble

ClickMenu

Oct 29th, 2017
212
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.95 KB | None | 0 0
  1. local x, y = 1,4
  2. local x2, y2 = 1,6
  3. local x3, y3 = 1,8
  4. local x4, y4 = 1,10
  5. local x5, y5 = 1,12
  6. local x6, y6 = 1,14
  7. local x7, y7 = 1,16
  8. local x8, y8 = 1,18
  9. local choice1 = "[ ] TurtleMenu "
  10. local choice2 = "[ ] Chat "
  11. local choice3 = "[ ] Calculator "
  12. local choice4 = "[ ] Notes "
  13. local choice5 = "[ ] Games "
  14. local choice6 = "[ ] Comp. Info "
  15. local choice7 = "[ ] Options "
  16. local choice8 = "[ ] Sleep "
  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. term.setCursorPos(x, y)
  32. term.setTextColor(colors.white)
  33. write(choice1)
  34. term.setCursorPos(x2, y2)
  35. write(choice2)
  36. term.setCursorPos(x3, y3)
  37. write(choice3)
  38. term.setCursorPos(x4, y4)
  39. write(choice4)
  40. term.setCursorPos(x5, y5)
  41. write(choice5)
  42. term.setCursorPos(x6, y6)
  43. write(choice6)
  44. term.setCursorPos(x7, y7)
  45. write(choice7)
  46. term.setCursorPos(x8, y8)
  47. write(choice8)
  48. end
  49.  
  50. drawMenu()
  51.  
  52. while true do
  53. local event, button, cx, cy = os.pullEvent()
  54. if event == "mouse_click" then
  55. if cx >= x and cx < choice1:len() and cy == y and button == 1 then
  56. term.clear()
  57. term.setCursorPos(1, 1)
  58. term.setTextColor(colors.white)
  59. shell.run("turtlemenu")
  60. elseif cx >= x2 and cx < choice2:len() and cy == y2 and button == 1 then
  61. term.clear()
  62. term.setCursorPos(1, 1)
  63. term.setTextColor(colors.white)
  64. shell.run("chat")
  65. elseif cx >= x3 and cx < choice3:len() and cy == y3 and button == 1 then
  66. term.clear()
  67. term.setCursorPos(1, 1)
  68. term.setTextColor(colors.white)
  69. shell.run("calculator")
  70. elseif cx >= x4 and cx < choice4:len() and cy == y4 and button == 1 then
  71. term.clear()
  72. term.setCursorPos(1, 1)
  73. term.setTextColor(colors.white)
  74. shell.run("notes")
  75. elseif cx >= x5 and cx < choice5:len() and cy == y5 and button == 1 then
  76. term.clear()
  77. term.setCursorPos(1, 1)
  78. term.setTextColor(colors.white)
  79. shell.run("games")
  80. elseif cx >= x6 and cx < choice6:len() and cy == y6 and button == 1 then
  81. term.clear()
  82. term.setCursorPos(1, 1)
  83. term.setTextColor(colors.white)
  84. shell.run("id")
  85. sleep(5)
  86. shell.run("menu")
  87. elseif cx >= x7 and cx < choice7:len() and cy == y7 and button == 1 then
  88. term.clear()
  89. term.setCursorPos(2, 2)
  90. shell.run("options")
  91. elseif cx >= x8 and cx < choice8:len() and cy == y8 and button == 1 then
  92. term.clear()
  93. term.setCursorPos(1, 1)
  94. term.setTextColor(colors.white)
  95. print("Goodbye...")
  96. sleep(1)
  97. os.shutdown()
  98. end
  99. -- break
  100. end
  101. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement