Guest User

Elevator Menu

a guest
Nov 5th, 2012
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.85 KB | None | 0 0
  1. x = 1
  2. y = 1
  3. z = 3
  4. local nTime = os.time()
  5. t = textutils.formatTime(nTime, true)
  6. while true do
  7. term.clear()
  8. term.setCursorPos(1,2)
  9. print("--------------------------------------------------")
  10. print("--------------------------------------------------")
  11. term.setCursorPos(3,4)
  12. print("Ground Floor")
  13. term.setCursorPos(44,4)
  14. print(t)
  15. term.setCursorPos(1,8)
  16. print(" 0  Server Room")
  17. print(" 1  1st Floor")
  18. print(" 2  2nd Floor")
  19. print(" 3  3rd Floor")
  20. print(" 4  4th Floor")
  21. print(" 5  5th Floor")
  22. print(" 6  6th Floor")
  23. print(" 7  7th Floor")
  24. print(" 8  8th Floor")
  25. print(" 9  9th Floor")
  26. print("10 10th Floor")
  27. print("11 11th Floor")
  28. print("12 12th Floor")
  29. print("13 13th Floor")
  30. print("14 14th Floor")
  31. print("15 15th Floor")
  32. print("16 16th Floor")
  33. print("17 17th Floor")
  34. print("18 18th Floor")
  35. term.setCursorPos(x,y)
  36. print("[")
  37. term.setCursorPos(z,y)
  38. print("]")
  39. event, key = os.pullEvent()
  40. if key == 208 and y < 40 then
  41. y = y+1
  42. elseif key == 208 and y == 40 then
  43. y = 40
  44. elseif key == 200 and y > 1 then
  45. y = y-1
  46. elseif key == 200 and y == 8 then
  47. y = 8
  48. elseif key == 28 then
  49. if y == 1 then
  50. shell.run("down1")
  51. elseif y == 2 then
  52. shell.run("up1")
  53. elseif y == 3 then
  54. shell.run("up2")
  55. elseif y == 4 then
  56. shell.run("up3")
  57. elseif y == 5 then
  58. shell.run("up4")
  59. elseif y == 6 then
  60. shell.run("up5")
  61. elseif y == 7 then
  62. shell.run("up6")
  63. elseif y == 8 then
  64. shell.run("up7")
  65. elseif y == 9 then
  66. shell.run("up8")
  67. elseif y == 10 then
  68. shell.run("up9")
  69. elseif y == 11 then
  70. shell.run("up10")
  71. elseif y == 12 then
  72. shell.run("up11")
  73. elseif y == 13 then
  74. shell.run("up12")
  75. elseif y == 14 then
  76. shell.run("up13")
  77. elseif y == 15 then
  78. shell.run("up14")
  79. elseif y == 16 then
  80. shell.run("up15")
  81. elseif y == 17 then
  82. shell.run("up16")
  83. elseif y == 18 then
  84. shell.run("up17")
  85. else
  86. term.setCursorPos(1,11)
  87. print("system error")
  88. sleep(2)
  89. end
  90. end
  91. end
Advertisement
Add Comment
Please, Sign In to add comment