Advertisement
NolanSyKinsley

Untitled

Apr 1st, 2014
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.04 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"] = 1,
  10. ["lineColour"] = 0x000000,
  11. ["middleColour"] = 0xFFFFFF
  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. function ChangeWidth()
  150. while true do
  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]) == "width" then
  159. variables["width"] = tonumber(words[1])
  160. redraw()
  161. end
  162. end
  163. end
  164.  
  165. function ChangeHeight()
  166. while true do
  167. local evt,command = os.pullEvent("chat_command")
  168. words = {}
  169. i = 0
  170. for word in string.gmatch(command, "%S+") do
  171. words[i] = word
  172. i = i + 1
  173. end
  174. if string.lower(words[0]) == "height" then
  175. variables["height"] = tonumber(words[1])
  176. redraw()
  177. end
  178. end
  179. end
  180.  
  181. function ChangeLineColor()
  182. while true do
  183. local evt,command = os.pullEvent("chat_command")
  184. words = {}
  185. i = 0
  186. for word in string.gmatch(command, "%S+") do
  187. words[i] = word
  188. i = i + 1
  189. end
  190. if string.lower(words[0]) == "linecolour" then
  191. variables["lineColour"] = tonumber(words[1])
  192. redraw()
  193. end
  194. end
  195. end
  196.  
  197. function ChangeMiddleColor()
  198. while true do
  199. local evt,command = os.pullEvent("chat_command")
  200. words = {}
  201. i = 0
  202. for word in string.gmatch(command, "%S+") do
  203. words[i] = word
  204. i = i + 1
  205. end
  206. if string.lower(words[0]) == "middlecolour" then
  207. variables["middleColour"] = tonumber(words[1])
  208. redraw()
  209. end
  210. end
  211. end
  212.  
  213. function ChangeLineTransparency()
  214. while true do
  215. local evt,command = os.pullEvent("chat_command")
  216. words = {}
  217. i = 0
  218. for word in string.gmatch(command, "%S+") do
  219. words[i] = word
  220. i = i + 1
  221. end
  222. if string.lower(words[0]) == "linetransparency" then
  223. variables["lineTransparency"] = tonumber(words[1])
  224. redraw()
  225. end
  226. end
  227. end
  228.  
  229. function ChangeMiddleTransparency()
  230. while true do
  231. local evt,command = os.pullEvent("chat_command")
  232. words = {}
  233. i = 0
  234. for word in string.gmatch(command, "%S+") do
  235. words[i] = word
  236. i = i + 1
  237. end
  238. if string.lower(words[0]) == "middletransparency" then
  239. variables["innerTransparency"] = tonumber(words[1])
  240. redraw()
  241. end
  242. end
  243. end
  244.  
  245. function KillHUD()
  246. while true do
  247. local evt,command = os.pullEvent("chat_command")
  248. words = {}
  249. i = 0
  250. for word in string.gmatch(command, "%S+") do
  251. words[i] = word
  252. i = i + 1
  253. end
  254. if string.lower(words[0]) == "kill" then
  255. p.clear()
  256. end
  257. end
  258. end
  259.  
  260. function Suction()
  261. redStoneBottom = false
  262. while true do
  263. local evt,command = os.pullEvent("chat_command")
  264. words = {}
  265. i = 0
  266. for word in string.gmatch(command, "%S+") do
  267. words[i] = word
  268. i = i + 1
  269. end
  270. if string.lower(words[0]) == "suction" then
  271. redStoneBottom = (words[1])
  272. end
  273. if redStoneBottome == true then
  274. redstone.setOutput("bottom", true)
  275. else
  276. redstone.setOutput("bottom", false)
  277. end
  278. end
  279. end
  280.  
  281. while true do
  282. parallel.waitForAny(Suction, ChangeWidth, ChangeHeight, ChangeLineColor, ChangeLineTransparency, ChangeMiddleColor, ChangeMiddleTransparency, KillHUD)
  283. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement