Advertisement
RobotBubble

ClickOptions

Oct 29th, 2017
156
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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 choice1 = "[ ] Menu "
  8. local choice2 = "[ ] Rename "
  9. local choice3 = "[ ] Help "
  10. local choice4 = "[ ] Admin. Access "
  11. local choice5 = "[ ] Erase Data "
  12. local choice6 = "[ ] Switch UI "
  13.  
  14. term.clear()
  15. term.setCursorPos(1, 1)
  16. term.setTextColor(colors.lightGray)
  17. print("--------------------------")
  18. print("---")
  19. term.setTextColor(colors.lightBlue)
  20. term.setCursorPos(4, 2)
  21. print("Bubble Bot Computers")
  22. term.setTextColor(colors.lightGray)
  23. term.setCursorPos(24, 2)
  24. print("---")
  25. print("--------------------------")
  26. local function drawMenu()
  27. sleep(.1)
  28. term.setCursorPos(x, y)
  29. term.setTextColor(colors.white)
  30. write(choice1)
  31. term.setCursorPos(x2, y2)
  32. write(choice2)
  33. term.setCursorPos(x3, y3)
  34. write(choice3)
  35. term.setCursorPos(x4, y4)
  36. write(choice4)
  37. term.setCursorPos(x5, y5)
  38. write(choice5)
  39. term.setCursorPos(x6, y6)
  40. write(choice6)
  41. end
  42.  
  43. drawMenu()
  44.  
  45. while true do
  46. local event, button, cx, cy = os.pullEvent()
  47. if event == "mouse_click" then
  48. if cx >= x and cx < choice1:len() and cy == y and button == 1 then
  49. term.clear()
  50. term.setCursorPos(1, 1)
  51. term.setTextColor(colors.white)
  52. shell.run("menu")
  53. elseif cx >= x2 and cx < choice2:len() and cy == y2 and button == 1 then
  54. term.clear()
  55. term.setCursorPos(1, 1)
  56. term.setTextColor(colors.white)
  57. shell.run("name")
  58. elseif cx >= x3 and cx < choice3:len() and cy == y3 and button == 1 then
  59. term.clear()
  60. term.setCursorPos(1, 1)
  61. term.setTextColor(colors.white)
  62. shell.run("help")
  63. elseif cx >= x4 and cx < choice4:len() and cy == y4 and button == 1 then
  64. term.clear()
  65. term.setCursorPos(1, 1)
  66. term.setTextColor(colors.white)
  67. print("Admin access is not")
  68. print("available for the")
  69. print("mouse UI. To access")
  70. print("coding use CTRL + T")
  71. print("several times")
  72. sleep(5)
  73. shell.run("options")
  74. elseif cx >= x5 and cx < choice5:len() and cy == y5 and button == 1 then
  75. term.clear()
  76. term.setCursorPos(1, 1)
  77. term.setTextColor(colors.white)
  78. shell.run("erase")
  79. elseif cx >= x6 and cx < choice6:len() and cy == y6 and button == 1 then
  80. term.clear()
  81. term.setCursorPos(1, 1)
  82. term.setTextColor(colors.white)
  83. shell.run("ui")
  84. end
  85. end
  86. end
Advertisement
RAW Paste Data Copied
Advertisement