SuPeRMiNoR3

Output API

Nov 28th, 2012
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.32 KB | None | 0 0
  1. --[[
  2. Output API, By SuPeRMiNoR2
  3. LICENSE
  4. http://creativecommons.org/licenses/by-nc/3.0/
  5. This license only applies to THIS PROGRAM, not to minecraft, computercraft, or redpower
  6. You may edit, and/or use this program/API in your own programs/APIS, provided you leave the license comment in. ]]--
  7. --Version: 1.4
  8.  
  9. local output_side = "back"
  10. local output_white = 0
  11. local output_orange = 0
  12. local output_magenta = 0
  13. local output_lightblue = 0
  14. local output_yellow = 0
  15. local output_lime = 0
  16. local output_pink = 0
  17. local output_gray = 0
  18. local output_lightgray = 0
  19. local output_cyan = 0
  20. local output_purple = 0
  21. local output_blue = 0
  22. local output_brown = 0
  23. local output_green = 0
  24. local output_red = 0
  25. local output_black = 0
  26. local output = 0
  27.  
  28.  
  29. function alloff()
  30. output_white = 0
  31. output_orange = 0
  32. output_magenta = 0
  33. output_lightblue = 0
  34. output_yellow = 0
  35. output_lime = 0
  36. output_pink = 0
  37. output_gray = 0
  38. output_lightgray = 0
  39. output_cyan = 0
  40. output_purple = 0
  41. output_blue = 0
  42. output_brown = 0
  43. output_green = 0
  44. output_red = 0
  45. output_black = 0
  46. update()
  47. end
  48.  
  49. function set(color, state)
  50. if state == true then
  51. state = 1
  52. end
  53. if state == false then
  54. state = 0
  55. end
  56. if color == "white" then
  57. output_white = state
  58. end
  59. if color == "orange" then
  60. output_orange = state
  61. end
  62. if color == "magenta" then
  63. output_magenta = state
  64. end
  65. if color == "lightBlue" then
  66. output_lightblue = state
  67. end
  68. if color == "yellow" then
  69. output_yellow = state
  70. end
  71. if color == "lime" then
  72. output_lime = state
  73. end
  74. if color == "pink" then
  75. output_pink = state
  76. end
  77. if color == "gray" then
  78. output_gray = state
  79. end
  80. if color == "lightGray" then
  81. output_lightgray = state
  82. end
  83. if color == "cyan" then
  84. output_cyan = state
  85. end
  86. if color == "purple" then
  87. output_purple = state
  88. end
  89. if color == "blue" then
  90. output_blue = state
  91. end
  92. if color == "brown" then
  93. output_brown = state
  94. end
  95. if color == "green" then
  96. output_green = state
  97. end
  98. if color == "red" then
  99. output_red = state
  100. end
  101. if color == "black" then
  102. output_black = state
  103. end
  104. update()
  105. end
  106.  
  107. function get(color)
  108. color = colors[color]
  109. return rs.testBundledInput(output_side, color)
  110. end
  111.  
  112. function setside(side)
  113. output_side = side
  114. end
  115.  
  116. function update()
  117. output = 0
  118. if output_white == 1 then
  119. output = output + colors.white
  120. end
  121. if output_orange == 1 then
  122. output = output + colors.orange
  123. end
  124. if output_magenta == 1 then
  125. output = output + colors.magenta
  126. end
  127. if output_lightblue == 1 then
  128. output = output + colors.lightBlue
  129. end
  130. if output_yellow == 1 then
  131. output = output + colors.yellow
  132. end
  133. if output_lime == 1 then
  134. output = output + colors.lime
  135. end
  136. if output_pink == 1 then
  137. output = output + colors.pink
  138. end
  139. if output_gray == 1 then
  140. output = output + colors.gray
  141. end
  142. if output_lightgray == 1 then
  143. output = output + colors.lightGray
  144. end
  145. if output_cyan == 1 then
  146. output = output + colors.cyan
  147. end
  148. if output_purple == 1 then
  149. output = output + colors.purple
  150. end
  151. if output_blue == 1 then
  152. output = output + colors.blue
  153. end
  154. if output_brown == 1 then
  155. output = output + colors.brown
  156. end
  157. if output_green == 1 then
  158. output = output + colors.green
  159. end
  160. if output_red == 1 then
  161. output = output + colors.red
  162. end
  163. if output_black == 1 then
  164. output = output + colors.black
  165. end
  166. rs.setBundledOutput(output_side, output)
  167. end
  168.  
  169. function help()
  170. return "The output api, by SuPeRMiNoR2."
  171. end
Advertisement
Add Comment
Please, Sign In to add comment