Advertisement
jemo_eder

Untitled

Jan 22nd, 2017
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.68 KB | None | 0 0
  1. local monitor = peripheral.wrap("bottom")
  2. function updateWireState()
  3. wires = {
  4. ["Purple"] = redstone.testBundledInput("back",colors.purple),
  5. ["Pink"] = redstone.testBundledInput("back",colors.pink),
  6. ["Orange"] = redstone.testBundledInput("back",colors.orange),
  7. ["Brown"] = redstone.testBundledInput("back",colors.brown),
  8. ["Blue"] = redstone.testBundledInput("back",colors.blue),
  9. ["Green"] = redstone.testBundledInput("back",colors.green),
  10. ["Yellow"] = redstone.testBundledInput("back",colors.yellow),
  11. ["White"] = redstone.testBundledInput("back",colors.white),
  12. ["Black"] = redstone.testBundledInput("back",colors.black),
  13. ["Gray"] = redstone.testBundledInput("back",colors.lightGray)
  14. }
  15. end
  16. function drawVoterColors()
  17. term.redirect(monitor)
  18. monitor.setTextScale(3)
  19. monitor.getSize()
  20. paintutils.drawFilledBox(0,0,0,0,colors.black)
  21. term.clear()
  22. --first row
  23. paintutils.drawFilledBox(1,1,5,1,colors.purple)
  24. paintutils.drawFilledBox(6,1,10,1,colors.pink)
  25. paintutils.drawFilledBox(11,1,14,1,colors.orange)
  26. paintutils.drawFilledBox(15,1,19,1,colors.brown)
  27. paintutils.drawFilledBox(20,1,24,1,colors.blue)
  28. --second row
  29. paintutils.drawFilledBox(1,3,5,3,colors.green)
  30. paintutils.drawFilledBox(6,3,10,3,colors.yellow)
  31. paintutils.drawFilledBox(11,3,14,3,colors.white)
  32. paintutils.drawFilledBox(15,3,19,3,colors.cyan) --corresponds to black cable because I am lazy
  33. paintutils.drawFilledBox(20,3,24,3,colors.lightGray)
  34. paintutils.drawFilledBox(0,0,0,0,colors.black)
  35. end
  36. function drawVotes()
  37. term.redirect(monitor)
  38. term.setCursorPos(2,2)
  39. if(wires["Purple"]) then
  40. term.setTextColor(colors.lime)
  41. monitor.write("Yes")
  42. else
  43. term.setTextColor(colors.red)
  44. monitor.write("No ")
  45. end
  46. term.setCursorPos(7,2)
  47. if(wires["Pink"]) then
  48. term.setTextColor(colors.lime)
  49. monitor.write("Yes")
  50. else
  51. term.setTextColor(colors.red)
  52. monitor.write("No ")
  53. end
  54. term.setCursorPos(12,2)
  55. if(wires["Orange"]) then
  56. term.setTextColor(colors.lime)
  57. monitor.write("Yes")
  58. else
  59. term.setTextColor(colors.red)
  60. monitor.write("No ")
  61. end
  62. term.setCursorPos(16,2)
  63. if(wires["Brown"]) then
  64. term.setTextColor(colors.lime)
  65. monitor.write("Yes")
  66. else
  67. term.setTextColor(colors.red)
  68. monitor.write("No ")
  69. end
  70. term.setCursorPos(21,2)
  71. if(wires["Blue"]) then
  72. term.setTextColor(colors.lime)
  73. monitor.write("Yes")
  74. else
  75. term.setTextColor(colors.red)
  76. monitor.write("No ")
  77. end
  78. term.setCursorPos(2,4)
  79. if(wires["Green"]) then
  80. term.setTextColor(colors.lime)
  81. monitor.write("Yes")
  82. else
  83. term.setTextColor(colors.red)
  84. monitor.write("No ")
  85. end
  86. term.setCursorPos(7,4)
  87. if(wires["Yellow"]) then
  88. term.setTextColor(colors.lime)
  89. monitor.write("Yes")
  90. else
  91. term.setTextColor(colors.red)
  92. monitor.write("No ")
  93. end
  94. term.setCursorPos(12,4)
  95. if(wires["White"]) then
  96. term.setTextColor(colors.lime)
  97. monitor.write("Yes")
  98. else
  99. term.setTextColor(colors.red)
  100. monitor.write("No ")
  101. end
  102. term.setCursorPos(16,4)
  103. if(wires["Black"]) then
  104. term.setTextColor(colors.lime)
  105. monitor.write("Yes")
  106. else
  107. term.setTextColor(colors.red)
  108. monitor.write("No ")
  109. end
  110. term.setCursorPos(21,4)
  111. if(wires["Gray"]) then
  112. term.setTextColor(colors.lime)
  113. monitor.write("Yes")
  114. else
  115. term.setTextColor(colors.red)
  116. monitor.write("No ")
  117. end
  118. end
  119.  
  120. --Start main function
  121. if monitor then
  122. term.write("Voting system by Jemo_Eder")
  123. drawVoterColors()
  124. updateWireState()
  125. drawVotes()
  126. term.setCursorPos(1,1)
  127. monitor.setCursorBlink(false)
  128. while true do
  129. os.pullEvent("redstone")
  130. updateWireState()
  131. drawVotes()
  132. end
  133. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement