Advertisement
tima_gt

tde-redstone 3.4-alpha

Aug 19th, 2014
287
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.56 KB | None | 0 0
  1. os.loadAPI("clickAPI")
  2. os.loadAPI("advPrint")
  3. button_off = paintutils.loadImage("tde-rOFF")
  4. button_ON = paintutils.loadImage("tde-rON")
  5. term.setBackgroundColor(colors.white)
  6. term.setTextColor(colors.gray)
  7. term.clear()
  8. on = off
  9. side = 'back'
  10. on = false
  11. while true do
  12. if on then
  13. term.clear()
  14. paintutils.drawImage(button_ON, 1, 1)
  15. else
  16. term.clear()
  17. paintutils.drawImage(button_off, 1, 1)
  18. end
  19. if side == 'back' then
  20. term.setCursorPos(1, 19)
  21. term.setBackgroundColor(colors.pink)
  22. term.setTextColor(colors.black)
  23. write('back')
  24. term.setBackgroundColor(colors.white)
  25. write(' front top bottom left right')
  26. elseif side == 'front' then
  27. term.setCursorPos(1, 19)
  28. term.setBackgroundColor(colors.white)
  29. term.setTextColor(colors.black)
  30. write('back ')
  31. term.setBackgroundColor(colors.pink)
  32. term.setTextColor(colors.black)
  33. write('front')
  34. term.setBackgroundColor(colors.white)
  35. write(' top bottom left right')
  36. elseif side == 'top' then
  37. term.setCursorPos(1, 19)
  38. term.setBackgroundColor(colors.white)
  39. term.setTextColor(colors.black)
  40. write('back front ')
  41. term.setBackgroundColor(colors.pink)
  42. write('top')
  43. term.setBackgroundColor(colors.white)
  44. write(' bottom left right')
  45. elseif side == 'bottom' then
  46. term.setCursorPos(1, 19)
  47. term.setBackgroundColor(colors.white)
  48. term.setTextColor(colors.black)
  49. write('back front top ')
  50. term.setBackgroundColor(colors.pink)
  51. write('bottom')
  52. term.setBackgroundColor(colors.white)
  53. write(' left right')
  54. elseif side == 'left' then
  55. term.setCursorPos(1, 19)
  56. term.setBackgroundColor(colors.white)
  57. term.setTextColor(colors.black)
  58. write('back front top bottom ')
  59. term.setBackgroundColor(colors.pink)
  60. write('left')
  61. term.setBackgroundColor(colors.white)
  62. write(' right')
  63. elseif side == 'right' then
  64. term.setCursorPos(1, 19)
  65. term.setBackgroundColor(colors.white)
  66. term.setTextColor(colors.black)
  67. write('back front top bottom left ')
  68. term.setBackgroundColor(colors.pink)
  69. write('right')
  70. end
  71. term.setTextColor(colors.red)
  72. term.setBackgroundColor(colors.white)
  73. advPrint.tout(1, "X                    Redstone 3.3")
  74. local event, button, X, Y = os.pullEventRaw()
  75.   if event == "mouse_click" then
  76. if (X>=3 and Y>=3 and X<=13 and Y<=17) and (on == false) then
  77. on = true
  78. redstone.setOutput(side, true)
  79. elseif (X>=3 and Y>=3 and X<=13 and Y<=17) and (on == true) then
  80. on = false
  81. redstone.setOutput(side, false)
  82. elseif X == 1 and Y == 1 then
  83. redstone.setOutput('back', false)
  84. redstone.setOutput('front', false)
  85. redstone.setOutput('top', false)
  86. redstone.setOutput('bottom', false)
  87. redstone.setOutput('left', false)
  88. redstone.setOutput('right', false)
  89. term.setBackgroundColor(colors.black)
  90. term.clear()
  91. term.setCursorPos(1, 1)
  92. break
  93. elseif X >= 1 and X <= 4 and Y == 19 then
  94. if sideD ~= side then
  95. redstone.setOutput('back', false)
  96. redstone.setOutput('front', false)
  97. redstone.setOutput('top', false)
  98. redstone.setOutput('bottom', false)
  99. redstone.setOutput('left', false)
  100. redstone.setOutput('right', false)
  101. sideD = side
  102. on = false
  103. end
  104. side = "back"
  105. elseif X >= 5 and X <= 10 and Y == 19 then
  106. if sideD ~= side then
  107. redstone.setOutput('back', false)
  108. redstone.setOutput('front', false)
  109. redstone.setOutput('top', false)
  110. redstone.setOutput('bottom', false)
  111. redstone.setOutput('left', false)
  112. redstone.setOutput('right', false)
  113. on = false
  114. end
  115. sideD = side
  116. side = "front"
  117. elseif X >= 11 and X <= 14 and Y == 19 then
  118. if sideD ~= side then
  119. redstone.setOutput('back', false)
  120. redstone.setOutput('front', false)
  121. redstone.setOutput('top', false)
  122. redstone.setOutput('bottom', false)
  123. redstone.setOutput('left', false)
  124. redstone.setOutput('right', false)
  125. end
  126. on = false
  127. side = "top"
  128. elseif X >= 15 and X <= 15 + 6 and Y == 19 then
  129. if sideD ~= side then
  130. redstone.setOutput('back', false)
  131. redstone.setOutput('front', false)
  132. redstone.setOutput('top', false)
  133. redstone.setOutput('bottom', false)
  134. redstone.setOutput('left', false)
  135. redstone.setOutput('right', false)
  136. end
  137. on = false
  138. side = "bottom"
  139. elseif X >= 15 + 7 and X <= 15 + 7 + 4 and Y == 19 then
  140. if sideD ~= side then
  141. redstone.setOutput('back', false)
  142. redstone.setOutput('front', false)
  143. redstone.setOutput('top', false)
  144. redstone.setOutput('bottom', false)
  145. redstone.setOutput('left', false)
  146. redstone.setOutput('right', false)
  147. end
  148. on = false
  149. side = "left"
  150. elseif X >= 15 + 7 + 5 and X <= 15 + 7 + 10 and Y == 19 then
  151. if sideD ~= side then
  152. redstone.setOutput('back', false)
  153. redstone.setOutput('front', false)
  154. redstone.setOutput('top', false)
  155. redstone.setOutput('bottom', false)
  156. redstone.setOutput('left', false)
  157. redstone.setOutput('right', false)
  158. sideD = side
  159. end
  160. on = false
  161. side = "right"
  162. end
  163. end
  164.  
  165. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement