Advertisement
NolanSyKinsley

Untitled

Apr 1st, 2014
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.58 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. local evt,command = os.pullEvent("chat_command")
  152. words = {}
  153. i = 0
  154. for word in string.gmatch(command, "%S+") do
  155. words[i] = word
  156. i = i + 1
  157. end
  158. if string.lower(words[0]) == "kill" then
  159. p.clear()
  160. end
  161. end
  162. end
  163.  
  164. function Suction()
  165. local evt,command = os.pullEvent("chat_command")
  166. words = {}
  167. i = 0
  168. for word in string.gmatch(command, "%S+") do
  169. words[i] = word
  170. i = i + 1
  171. end
  172. local redStoneBottom = false
  173. if redStoneBottom == true then
  174. redstone.setOutput("bottom", true)
  175. else
  176. redstone.setOutput("bottom", false)
  177. end
  178. if string.lower(words[0]) == "suction" then
  179. redStoneBottom = (words[1])
  180. end
  181. end
  182. end
  183.  
  184. while true do
  185. parallel.waitForAny(Suction, KillHUD)
  186. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement