Advertisement
Scalpweb

Untitled

Feb 10th, 2016
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.15 KB | None | 0 0
  1. mouseWidth = 0
  2. mouseHeight = 0
  3.  
  4. monitor3 = peripheral.wrap("monitor_5")
  5. monitor3.setBackgroundColor((colors.black))
  6. monitor3.clear()
  7. monitor3.setTextScale(.5)
  8. monitor3.setCursorPos(5,9)
  9. monitor3.write(" B3 ")
  10.  
  11. monitor2 = peripheral.wrap("monitor_4")
  12. monitor2.setBackgroundColor((colors.black))
  13. monitor2.clear()
  14. monitor2.setTextScale(.5)
  15. monitor2.setCursorPos(5,9)
  16. monitor2.write(" B2 ")
  17.  
  18. monitor1 = peripheral.wrap("monitor_6")
  19. monitor1.setBackgroundColor((colors.black))
  20. monitor1.clear()
  21. monitor1.setTextScale(.5)
  22. monitor1.setCursorPos(5,9)
  23. monitor1.write(" B1 ")
  24.  
  25. function buttons()
  26.  
  27. monitor1.setBackgroundColor((colors.lime))
  28. monitor1.setCursorPos(1,1)
  29. monitor1.write("Call")
  30. monitor1.setBackgroundColor((colors.blue))
  31. monitor1.setCursorPos(5,2)
  32. monitor1.write(" E3 ")
  33. monitor1.setBackgroundColor((colors.blue))
  34. monitor1.setCursorPos(5,3)
  35. monitor1.write(" E2 ")
  36. monitor1.setBackgroundColor((colors.blue))
  37. monitor1.setCursorPos(5,4)
  38. monitor1.write(" E1 ")
  39. monitor1.setBackgroundColor((colors.blue))
  40.  
  41. monitor2.setBackgroundColor((colors.lime))
  42. monitor2.setCursorPos(1,1)
  43. monitor2.write("Call")
  44. monitor2.setBackgroundColor((colors.blue))
  45. monitor2.setCursorPos(5,2)
  46. monitor2.write(" E3 ")
  47. monitor2.setBackgroundColor((colors.blue))
  48. monitor2.setCursorPos(5,3)
  49. monitor2.write(" E2 ")
  50. monitor2.setBackgroundColor((colors.blue))
  51. monitor2.setCursorPos(5,4)
  52. monitor2.write(" E1 ")
  53. monitor2.setBackgroundColor((colors.blue))
  54.  
  55. monitor3.setBackgroundColor((colors.lime))
  56. monitor3.setCursorPos(1,1)
  57. monitor3.write("Call")
  58. monitor3.setBackgroundColor((colors.blue))
  59. monitor3.setCursorPos(5,2)
  60. monitor3.write(" E3 ")
  61. monitor3.setBackgroundColor((colors.blue))
  62. monitor3.setCursorPos(5,3)
  63. monitor3.write(" E2 ")
  64. monitor3.setBackgroundColor((colors.blue))
  65. monitor3.setCursorPos(5,4)
  66. monitor3.write(" E1 ")
  67. monitor3.setBackgroundColor((colors.blue))
  68.  
  69. end
  70.  
  71. function floorB3()
  72. rs.setBundledOutput("left",colors.white)
  73.  
  74. monitor1.setBackgroundColor((colors.red))
  75. monitor1.setCursorPos(5,2)
  76. monitor1.write(" E3 ")
  77.  
  78. monitor2.setBackgroundColor((colors.red))
  79. monitor2.setCursorPos(5,2)
  80. monitor2.write(" E3 ")
  81.  
  82. monitor3.setBackgroundColor((colors.red))
  83. monitor3.setCursorPos(5,2)
  84. monitor3.write(" E3 ")
  85. end
  86.  
  87. function floorB2()
  88. rs.setBundledOutput("left",colors.gray)
  89.  
  90. monitor1.setBackgroundColor((colors.red))
  91. monitor1.setCursorPos(5,3)
  92. monitor1.write(" E2 ")
  93.  
  94. monitor2.setBackgroundColor((colors.red))
  95. monitor2.setCursorPos(5,3)
  96. monitor2.write(" E2 ")
  97.  
  98. monitor3.setBackgroundColor((colors.red))
  99. monitor3.setCursorPos(5,3)
  100. monitor3.write(" E2 ")
  101. end
  102.  
  103. function floorB1()
  104. rs.setBundledOutput("left",colors.purple)
  105.  
  106. monitor1.setBackgroundColor((colors.red))
  107. monitor1.setCursorPos(5,4)
  108. monitor1.write(" E1 ")
  109.  
  110. monitor2.setBackgroundColor((colors.red))
  111. monitor2.setCursorPos(5,4)
  112. monitor2.write(" E1 ")
  113.  
  114. monitor3.setBackgroundColor((colors.red))
  115. monitor3.setCursorPos(5,4)
  116. monitor3.write(" E1 ")
  117. end
  118.  
  119. buttons()
  120.  
  121. function checkClickPosition()
  122. buttons()
  123.  
  124. if mouseWidth > 5 and mouseWidth < 12 and mouseHeight == 3 then
  125. print "b3"
  126. floorB3()
  127. elseif mouseWidth > 5 and mouseWidth < 12 and mouseHeight == 4 then
  128. print "b2"
  129. floorB2()
  130. elseif mouseWidth > 5 and mouseWidth < 12 and mouseHeight == 5 then
  131. print "b1"
  132. floorB1()
  133. elseif mouseWidth < 5 and mouseHeight < 3 then
  134.  
  135. if p1 == "monitor_3" then
  136. floorB3()
  137. elseif p1 == "monitor_4" then
  138. floorB2()
  139. elseif p1 == "monitor_0" then
  140. floorB1()
  141. end
  142.  
  143. end
  144. monitor1.setBackgroundColor((colors.black))
  145. monitor2.setBackgroundColor((colors.black))
  146. monitor3.setBackgroundColor((colors.black))
  147. end
  148.  
  149. -- event will be "monitor_touch"
  150. -- p1 will be the side the monitor is on (top)
  151. -- p2 is the width postion of the click
  152. -- p3 is the height postition of the click
  153.  
  154.  
  155. repeat
  156. -- repeat runs a loop of code.
  157.  
  158. event,p1,p2,p3 = os.pullEvent()
  159.  
  160. if event=="monitor_touch" then
  161.  
  162. mouseWidth = p2
  163. mouseHeight = p3
  164. checkClickPosition()
  165.  
  166. end
  167.  
  168. until event=="char" and p1==("x")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement