Advertisement
jared314

Untitled

Jul 24th, 2015
327
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.16 KB | None | 0 0
  1. function start()
  2. m = peripheral.wrap("right")
  3. m.clear()
  4. m.setCursorPos(1,1)
  5. m.write("Select Floor:")
  6.  
  7. writeAllLevels()
  8.  
  9. while true do
  10. parallel.waitForAny(touch, wireless)
  11. end
  12.  
  13. end
  14.  
  15. function touch()
  16. event,side,x,y = os.pullEvent()
  17. rednet.open('top')
  18.  
  19. if y == 3 then
  20. rednet.broadcast('6')
  21. writeAllLevels()
  22. writeLevel(3, true, "4 - Autocrafting")
  23. else if y == 4 then
  24. rednet.broadcast('5')
  25. writeAllLevels()
  26. writeLevel(4, true, "3 - AE Control")
  27. else if y == 5 then
  28. rednet.broadcast('4')
  29. writeAllLevels()
  30. writeLevel(5, true, "2 - AE Control")
  31. else if y == 6 then
  32. rednet.broadcast('3')
  33. writeAllLevels()
  34. writeLevel(6, true, "L - Lobby ")
  35. else if y == 7 then
  36. rednet.broadcast('2')
  37. writeAllLevels()
  38. writeLevel(7, true, "B1 - Mine lvl 40")
  39. else if y == 8 then
  40. rednet.broadcast('1')
  41. writeAllLevels()
  42. writeLevel(8, true, "B2 - Bedrock")
  43. end
  44. end
  45. end
  46. end
  47. end
  48. end
  49. end
  50.  
  51. function wireless()
  52. rednet.open("top")
  53. ID, msg, distance = rednet.receive()
  54. if msg == '5' then
  55. writeAllLevels()
  56. writeLevel(3, true, "3 - Resource Processing")
  57. else if msg == '4' then
  58. writeAllLevels()
  59. writeLevel(4, true, "2 - AE Control")
  60. else if msg == '3' then
  61. writeAllLevels()
  62. writeLevel(5, true, "L - Lobby ")
  63. else if msg == '2' then
  64. writeAllLevels()
  65. writeLevel(6, true, "B1 - Mine lvl 40")
  66. else if msg == '1' then
  67. writeAllLevels()
  68. writeLevel(7, true, "B2 - Bedrock")
  69. end
  70. end
  71. end
  72. end
  73. end
  74.  
  75. end
  76.  
  77. function writeAllLevels()
  78. m.setBackgroundColor(colors.black)
  79. writeLevel(3, false, "4 - Autocrafting")
  80. writeLevel(4, false, "3 - Resource Processing")
  81. writeLevel(5, false, "2 - AE Control")
  82. writeLevel(6, false, "L - Lobby ")
  83. writeLevel(7, false, "B1 - Mine lvl 40")
  84. writeLevel(8, false, "B2 - Bedrock")
  85. end
  86.  
  87. function writeLevel(level, current, string)
  88. if current then
  89. m.setBackgroundColor(colors.blue)
  90. m.setCursorPos(1,level)
  91. m.write(string)
  92. else
  93. m.setBackgroundColor(colors.black)
  94. m.setCursorPos(1,level)
  95. m.write(string)
  96. end
  97. end
  98.  
  99. start()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement