Advertisement
NolanSyKinsley

Untitled

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