Advertisement
NolanSyKinsley

Untitled

Apr 1st, 2014
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.40 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. 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.  
  163. function ChangeHeight()
  164. local evt,command = os.pullEvent("chat_command")
  165. words = {}
  166. i = 0
  167. for word in string.gmatch(command, "%S+") do
  168. words[i] = word
  169. i = i + 1
  170. end
  171. if string.lower(words[0]) == "height" then
  172. variables["height"] = tonumber(words[1])
  173. redraw()
  174. end
  175. end
  176.  
  177. function ChangeLineColor()
  178. local evt,command = os.pullEvent("chat_command")
  179. words = {}
  180. i = 0
  181. for word in string.gmatch(command, "%S+") do
  182. words[i] = word
  183. i = i + 1
  184. end
  185. if string.lower(words[0]) == "linecolour" then
  186. variables["lineColour"] = tonumber(words[1])
  187. redraw()
  188. end
  189. end
  190.  
  191. function ChangeMiddleColor()
  192. local evt,command = os.pullEvent("chat_command")
  193. words = {}
  194. i = 0
  195. for word in string.gmatch(command, "%S+") do
  196. words[i] = word
  197. i = i + 1
  198. end
  199. if string.lower(words[0]) == "middlecolour" then
  200. variables["middleColour"] = tonumber(words[1])
  201. redraw()
  202. end
  203. end
  204.  
  205. function ChangeLineTransparency()
  206. local evt,command = os.pullEvent("chat_command")
  207. words = {}
  208. i = 0
  209. for word in string.gmatch(command, "%S+") do
  210. words[i] = word
  211. i = i + 1
  212. end
  213. if string.lower(words[0]) == "linetransparency" then
  214. variables["lineTransparency"] = tonumber(words[1])
  215. redraw()
  216. end
  217. end
  218.  
  219. function ChangeMiddleTransparency()
  220. local evt,command = os.pullEvent("chat_command")
  221. words = {}
  222. i = 0
  223. for word in string.gmatch(command, "%S+") do
  224. words[i] = word
  225. i = i + 1
  226. end
  227. if string.lower(words[0]) == "middletransparency" then
  228. variables["innerTransparency"] = tonumber(words[1])
  229. redraw()
  230. end
  231. end
  232.  
  233. function KillHUD()
  234. local evt,command = os.pullEvent("chat_command")
  235. words = {}
  236. i = 0
  237. for word in string.gmatch(command, "%S+") do
  238. words[i] = word
  239. i = i + 1
  240. end
  241. if string.lower(words[0]) == "kill" then
  242. p.clear()
  243. end
  244. end
  245.  
  246. while true do
  247. parallel.waitForAny(ChangeWidth, ChangeHeight, ChangeLineColor, ChangeLineTransparency, ChangeMiddleColor, ChangeMiddleTransparency, KillHUD)
  248. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement