Advertisement
NolanSyKinsley

Untitled

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