Advertisement
Guest User

Untitled

a guest
Dec 20th, 2014
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.26 KB | None | 0 0
  1. local function menu(...) -- ver 0.1
  2. local sel = 1
  3. local list = {...}
  4. local offX,offY = term.getCursorPos()
  5. local curX,curY = term.getCursorPos()
  6. while true do
  7. if sel > #list then sel = 1 end
  8. if sel < 1 then sel = #list end
  9. for i = 1,#list do
  10. term.setCursorPos(offX,offY+i-1)
  11. if sel == i then
  12. print("["..list[i].."]")
  13. else
  14. print(" "..list[i].." ")
  15. end
  16. end
  17. while true do
  18. local e,e1,e2,e3,e4,e5,e6 = os.pullEvent()
  19. if e == "key" then
  20. if e1 == 200 then -- up key
  21. sel = sel-1
  22. break
  23. end
  24. if e1 == 208 then -- down key
  25. sel = sel+1
  26. break
  27. end
  28. if e1 == 28 then
  29. term.setCursorPos(curX,curY)
  30. return list[sel],sel
  31. end
  32. end
  33. end
  34. end
  35. end
  36. -- Example Usage
  37. term.clear()
  38. term.setCursorPos(1,1)
  39. print("Uber Teleport Hub- RevJoe's Slipstream Transport System")
  40. term.setCursorPos(2,2)
  41. print("Please select Option")
  42. local selection = menu("Teleport 1","Teleport 2","Teleport 3","Teleport 4","Teleport 5","Teleport 6","Teleport 7","Teleport 8","VIP Teleport","EXIT")
  43.  
  44. if selection == "Teleport 1" then
  45. term.clear()
  46. term.setCursorPos(1,1)
  47. print("Activating Teleport, Please Hurry To Teleporter")
  48. sleep(1.5)
  49. redstone.setBundledOutput("back",colors.yellow,true)
  50. sleep(1)
  51. redstone.setBundledOutput("bottom",colors.yellow,false)
  52. os.reboot()
  53. end
  54. elseif selection == "Teleport 2" then
  55. term.clear()
  56. term.setCursorPos(1,1)
  57. print("Activating Teleport, Please Hurry To Teleporter")
  58. sleep(1.5)
  59. redstone.setBundledOutput("back",colors.yellow,true)
  60. sleep(1)
  61. redstone.setBundledOutput("bottom",colors.yellow,false)
  62. os.reboot()
  63. end
  64. elseif selection == "Teleport 3" then
  65. term.clear()
  66. term.setCursorPos(1,1)
  67. print("Activating Teleport, Please Hurry To Teleporter")
  68. sleep(1.5)
  69. redstone.setBundledOutput("back",colors.yellow,true)
  70. sleep(1)
  71. redstone.setBundledOutput("bottom",colors.yellow,false)
  72. os.reboot()
  73. end
  74. elseif selection == "Teleport 4" then
  75. term.clear()
  76. term.setCursorPos(1,1)
  77. print("Activating Teleport, Please Hurry To Teleporter")
  78. sleep(1.5)
  79. redstone.setBundledOutput("back",colors.yellow,true)
  80. sleep(1)
  81. redstone.setBundledOutput("bottom",colors.yellow,false)
  82. os.reboot()
  83. end
  84. elseif selection == "Teleport 5" then
  85. term.clear()
  86. term.setCursorPos(1,1)
  87. print("Activating Teleport, Please Hurry To Teleporter")
  88. sleep(1.5)
  89. redstone.setBundledOutput("back",colors.yellow,true)
  90. sleep(1)
  91. redstone.setBundledOutput("bottom",colors.yellow,false)
  92. os.reboot()
  93. end
  94. elseif selection == "Teleport 6" then
  95. term.clear()
  96. term.setCursorPos(1,1)
  97. print("Activating Teleport, Please Hurry To Teleporter")
  98. sleep(1.5)
  99. redstone.setBundledOutput("back",colors.yellow,true)
  100. sleep(1)
  101. redstone.setBundledOutput("bottom",colors.yellow,false)
  102. os.reboot()
  103. end
  104. elseif selection == "Teleport 7" then
  105. term.clear()
  106. term.setCursorPos(1,1)
  107. print("Activating Teleport, Please Hurry To Teleporter")
  108. sleep(1.5)
  109. redstone.setBundledOutput("back",colors.yellow,true)
  110. sleep(1)
  111. redstone.setBundledOutput("bottom",colors.yellow,false)
  112. os.reboot()
  113. end
  114. elseif selection == "Teleport 8" then
  115. term.clear()
  116. term.setCursorPos(1,1)
  117. print("Activating Teleport, Please Hurry To Teleporter")
  118. sleep(1.5)
  119. redstone.setBundledOutput("back",colors.yellow,true)
  120. sleep(1)
  121. redstone.setBundledOutput("bottom",colors.yellow,false)
  122. os.reboot()
  123. end
  124. elseif selection == "VIP Teleport" then
  125. term.clear()
  126. password = "level2"
  127. term.setCursorPos(1,1)
  128. print("VIP Access Only, Please Enter Security Code:-")
  129. pass = read("*")
  130. if pass == password then
  131. print("Security Code Accepted, VIP Teleport Activating")
  132. sleep(2)
  133. redstone.setBundledOutput("back",colors.orange,true)
  134. sleep(5)
  135. redstone.setBundledOutput("back",colors.orange,false)
  136. os.reboot()
  137. else
  138. term.clear()
  139. term.setCursorPos(1,1)
  140. print("Wrong Code Entered, Better Luck Next Time")
  141. sleep(0.5)
  142. os.reboot()
  143. end
  144. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement