Advertisement
NolanSyKinsley

Untitled

Apr 1st, 2014
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.62 KB | None | 0 0
  1. ae = peripheral.wrap("left")
  2. p = peripheral.wrap("right")
  3. p.clear()
  4.  
  5. variables = {
  6. ["width"] = 200,
  7. ["height"] = 100,
  8. ["lineTransparency"] = 1,
  9. ["innerTransparency"] = 0.5,
  10. ["lineColour"] = 0x000000,
  11. ["middleColour"] = 0x00000
  12. }
  13. groups = {
  14. ["left_transparency"] = {
  15. [1] = {x=2, y=11, width=1, height="height+00",colour="middleColour+0",transparency="innerTransparency+0",obj=p.addBox(0,0,0,0,0,0)},
  16. [2] = {x=3, y=08, width=1, height="height+06",colour="middleColour+0",transparency="innerTransparency+0",obj=p.addBox(0,0,0,0,0,0)},
  17. [3] = {x=4, y=06, width=1, height="height+10",colour="middleColour+0",transparency="innerTransparency+0",obj=p.addBox(0,0,0,0,0,0)},
  18. [4] = {x=5, y=05, width=1, height="height+12",colour="middleColour+0",transparency="innerTransparency+0",obj=p.addBox(0,0,0,0,0,0)},
  19. [5] = {x=6, y=04, width=2, height="height+14",colour="middleColour+0",transparency="innerTransparency+0",obj=p.addBox(0,0,0,0,0,0)},
  20. [6] = {x=8, y=03, width=3, height="height+16",colour="middleColour+0",transparency="innerTransparency+0",obj=p.addBox(0,0,0,0,0,0)}
  21. },
  22. ["middle_transparency"] = {
  23. [1] = {x=11,y=2,width="width+0",height="height+18",colour="middleColour+0",transparency="innerTransparency+0",obj=p.addBox(0,0,0,0,0,0)}
  24. },
  25. ["right_transparency"] = {
  26. [1] = {x="width+11", y=03, width=3, height="height+16",colour="middleColour+0",transparency="innerTransparency+0",obj=p.addBox(0,0,0,0,0,0)},
  27. [2] = {x="width+14", y=04, width=2, height="height+14",colour="middleColour+0",transparency="innerTransparency+0",obj=p.addBox(0,0,0,0,0,0)},
  28. [3] = {x="width+16", y=05, width=1, height="height+12",colour="middleColour+0",transparency="innerTransparency+0",obj=p.addBox(0,0,0,0,0,0)},
  29. [4] = {x="width+17", y=06, width=1, height="height+10",colour="middleColour+0",transparency="innerTransparency+0",obj=p.addBox(0,0,0,0,0,0)},
  30. [5] = {x="width+18", y=08, width=1, height="height+06",colour="middleColour+0",transparency="innerTransparency+0",obj=p.addBox(0,0,0,0,0,0)},
  31. [6] = {x="width+19", y=11, width=1, height="height+00",colour="middleColour+0",transparency="innerTransparency+0",obj=p.addBox(0,0,0,0,0,0)}
  32. },
  33. ["top_left"] = {
  34. [1] = {x=8,y=2,width=3,height=1,colour="lineColour+0",transparency="lineTransparency+0",obj=p.addBox(0,0,0,0,0,0)},
  35. [2] = {x=6,y=3,width=2,height=1,colour="lineColour+0",transparency="lineTransparency+0",obj=p.addBox(0,0,0,0,0,0)},
  36. [3] = {x=4,y=5,width=1,height=1,colour="lineColour+0",transparency="lineTransparency+0",obj=p.addBox(0,0,0,0,0,0)},
  37. [4] = {x=5,y=4,width=1,height=1,colour="lineColour+0",transparency="lineTransparency+0",obj=p.addBox(0,0,0,0,0,0)},
  38. [5] = {x=3,y=6,width=1,height=2,colour="lineColour+0",transparency="lineTransparency+0",obj=p.addBox(0,0,0,0,0,0)},
  39. [6] = {x=2,y=8,width=1,height=3,colour="lineColour+0",transparency="lineTransparency+0",obj=p.addBox(0,0,0,0,0,0)}
  40. },
  41. ["top"] = {
  42. [1] = {x=11,y=1,width="width+0",height=1,colour="lineColour+0",transparency="lineTransparency+0",obj=p.addBox(0,0,0,0,0,0)}
  43. },
  44. ["top_right"] = {
  45. [1] = {x="width+11",y=2,width=3,height=1,colour="lineColour+0",transparency="lineTransparency+0",obj=p.addBox(0,0,0,0,0,0)},
  46. [2] = {x="width+14",y=3,width=2,height=1,colour="lineColour+0",transparency="lineTransparency+0",obj=p.addBox(0,0,0,0,0,0)},
  47. [3] = {x="width+16",y=4,width=1,height=1,colour="lineColour+0",transparency="lineTransparency+0",obj=p.addBox(0,0,0,0,0,0)},
  48. [4] = {x="width+17",y=5,width=1,height=1,colour="lineColour+0",transparency="lineTransparency+0",obj=p.addBox(0,0,0,0,0,0)},
  49. [5] = {x="width+18",y=6,width=1,height=2,colour="lineColour+0",transparency="lineTransparency+0",obj=p.addBox(0,0,0,0,0,0)},
  50. [6] = {x="width+19",y=8,width=1,height=3,colour="lineColour+0",transparency="lineTransparency+0",obj=p.addBox(0,0,0,0,0,0)}
  51. },
  52. ["left"] = {
  53. [1] = {x=1,y=11,width=1,height="height+0",colour="lineColour+0",transparency="lineTransparency+0",obj=p.addBox(0,0,0,0,0,0)}
  54. },
  55. ["right"] = {
  56. [1] = {x="width+20",y=11,width=1,height="height+0",colour="lineColour+0",transparency="lineTransparency+0",obj=p.addBox(0,0,0,0,0,0)}
  57. },
  58. ["bottom_left"] = {
  59. [1] = {x=2,y="height+11",width=1,height=3,colour="lineColour+0",transparency="lineTransparency+0",obj=p.addBox(0,0,0,0,0,0)},
  60. [2] = {x=3,y="height+14",width=1,height=2,colour="lineColour+0",transparency="lineTransparency+0",obj=p.addBox(0,0,0,0,0,0)},
  61. [3] = {x=4,y="height+16",width=1,height=1,colour="lineColour+0",transparency="lineTransparency+0",obj=p.addBox(0,0,0,0,0,0)},
  62. [4] = {x=5,y="height+17",width=1,height=1,colour="lineColour+0",transparency="lineTransparency+0",obj=p.addBox(0,0,0,0,0,0)},
  63. [5] = {x=6,y="height+18",width=2,height=1,colour="lineColour+0",transparency="lineTransparency+0",obj=p.addBox(0,0,0,0,0,0)},
  64. [6] = {x=8,y="height+19",width=3,height=1,colour="lineColour+0",transparency="lineTransparency+0",obj=p.addBox(0,0,0,0,0,0)}
  65. },
  66. ["bottom"] = {
  67. [1] = {x=11,y="height+20",width="width+0",height=1,colour="lineColour+0",transparency="lineTransparency+0",obj=p.addBox(0,0,0,0,0,0)}
  68. },
  69. ["bottom_right"] = {
  70. [1] = {x="width+19",y="height+11",width=1,height=3,colour="lineColour+0",transparency="lineTransparency+0",obj=p.addBox(0,0,0,0,0,0)},
  71. [2] = {x="width+18",y="height+14",width=1,height=2,colour="lineColour+0",transparency="lineTransparency+0",obj=p.addBox(0,0,0,0,0,0)},
  72. [3] = {x="width+17",y="height+16",width=1,height=1,colour="lineColour+0",transparency="lineTransparency+0",obj=p.addBox(0,0,0,0,0,0)},
  73. [4] = {x="width+16",y="height+17",width=1,height=1,colour="lineColour+0",transparency="lineTransparency+0",obj=p.addBox(0,0,0,0,0,0)},
  74. [5] = {x="width+14",y="height+18",width=2,height=1,colour="lineColour+0",transparency="lineTransparency+0",obj=p.addBox(0,0,0,0,0,0)},
  75. [6] = {x="width+11",y="height+19",width=3,height=1,colour="lineColour+0",transparency="lineTransparency+0",obj=p.addBox(0,0,0,0,0,0)}
  76. }
  77. }
  78. function renderGroup(groupName)
  79. group = groups[groupName]
  80. for key, object in pairs(group) do
  81. if type(object["x"]) == "number" then
  82. object["obj"].setX(object["x"])
  83. elseif type(object["x"]) == "string" then
  84. t = {}
  85. for k, v in string.gmatch(object["x"], "(%w+)+(%w+)") do
  86. t[1] = k
  87. t[2] = v
  88. end
  89. object["obj"].setX(tonumber(variables[t[1]])+tonumber(t[2]))
  90. end
  91. if type(object["y"]) == "number" then
  92. object["obj"].setY(object["y"])
  93. elseif type(object["y"]) == "string" then
  94. t = {}
  95. for k, v in string.gmatch(object["y"], "(%w+)+(%w+)") do
  96. t[1] = k
  97. t[2] = v
  98. end
  99. object["obj"].setY(tonumber(variables[t[1]])+tonumber(t[2]))
  100. end
  101. if type(object["width"]) == "number" then
  102. object["obj"].setWidth(object["width"])
  103. elseif type(object["width"]) == "string" then
  104. t = {}
  105. for k, v in string.gmatch(object["width"], "(%w+)+(%w+)") do
  106. t[1] = k
  107. t[2] = v
  108. end
  109. object["obj"].setWidth(tonumber(variables[t[1]])+tonumber(t[2]))
  110. end
  111. if type(object["height"]) == "number" then
  112. object["obj"].setHeight(object["height"])
  113. elseif type(object["height"]) == "string" then
  114. t = {}
  115. for k, v in string.gmatch(object["height"], "(%w+)+(%w+)") do
  116. t[1] = k
  117. t[2] = v
  118. end
  119. object["obj"].setHeight(tonumber(variables[t[1]])+tonumber(t[2]))
  120. end
  121. if type(object["colour"]) == "number" then
  122. object["obj"].setColor(object["colour"])
  123. elseif type(object["colour"]) == "string" then
  124. t = {}
  125. for k, v in string.gmatch(object["colour"], "(%w+)+(%w+)") do
  126. t[1] = k
  127. t[2] = v
  128. end
  129. object["obj"].setColor(tonumber(variables[t[1]])+tonumber(t[2]))
  130. end
  131. if type(object["transparency"]) == "number" then
  132. object["obj"].setOpacity(object["transparency"])
  133. elseif type(object["transparency"]) == "string" then
  134. t = {}
  135. for k, v in string.gmatch(object["transparency"], "(%w+)+(%w+)") do
  136. t[1] = k
  137. t[2] = v
  138. end
  139. object["obj"].setOpacity(tonumber(variables[t[1]])+tonumber(t[2]))
  140. end
  141. end
  142. end
  143. function redraw()
  144. for key,value in pairs(groups) do
  145. renderGroup(key)
  146. end
  147. end
  148. redraw()
  149.  
  150. function KillHUD()
  151. while true do
  152. local evt,command = os.pullEvent("chat_command")
  153. words = {}
  154. i = 0
  155. for word in string.gmatch(command, "%S+") do
  156. words[i] = word
  157. i = i + 1
  158. end
  159. if string.lower(words[0]) == "kill" then
  160. p.clear()
  161. end
  162. end
  163. end
  164.  
  165. function Suction()
  166. while true do
  167. local redStoneBottom = false
  168. local evt,command = os.pullEvent("chat_command")
  169. words = {}
  170. i = 0
  171. for word in string.gmatch(command, "%S+") do
  172. words[i] = word
  173. i = i + 1
  174. end
  175. if string.lower(words[0]) == "suction" then
  176. redStoneBottom = (words[1])
  177. end
  178. if redStoneBottom == true then
  179. redstone.setOutput("bottom", true)
  180. else
  181. redstone.setOutput("bottom", false)
  182. end
  183. end
  184. end
  185.  
  186. while true do
  187. parallel.waitForAny(Suction, KillHUD)
  188. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement