Advertisement
RobotBubble

CClickMenu

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