Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local monitor = peripheral.wrap("bottom")
- function updateWireState()
- wires = {
- ["Purple"] = redstone.testBundledInput("back",colors.purple),
- ["Pink"] = redstone.testBundledInput("back",colors.pink),
- ["Orange"] = redstone.testBundledInput("back",colors.orange),
- ["Brown"] = redstone.testBundledInput("back",colors.brown),
- ["Blue"] = redstone.testBundledInput("back",colors.blue),
- ["Green"] = redstone.testBundledInput("back",colors.green),
- ["Yellow"] = redstone.testBundledInput("back",colors.yellow),
- ["White"] = redstone.testBundledInput("back",colors.white),
- ["Black"] = redstone.testBundledInput("back",colors.black),
- ["Gray"] = redstone.testBundledInput("back",colors.lightGray)
- }
- end
- function drawVoterColors()
- term.redirect(monitor)
- monitor.setTextScale(3)
- monitor.getSize()
- paintutils.drawFilledBox(0,0,0,0,colors.black)
- term.clear()
- --first row
- paintutils.drawFilledBox(1,1,5,1,colors.purple)
- paintutils.drawFilledBox(6,1,10,1,colors.pink)
- paintutils.drawFilledBox(11,1,14,1,colors.orange)
- paintutils.drawFilledBox(15,1,19,1,colors.brown)
- paintutils.drawFilledBox(20,1,24,1,colors.blue)
- --second row
- paintutils.drawFilledBox(1,3,5,3,colors.green)
- paintutils.drawFilledBox(6,3,10,3,colors.yellow)
- paintutils.drawFilledBox(11,3,14,3,colors.white)
- paintutils.drawFilledBox(15,3,19,3,colors.cyan) --corresponds to black cable because I am lazy
- paintutils.drawFilledBox(20,3,24,3,colors.lightGray)
- paintutils.drawFilledBox(0,0,0,0,colors.black)
- end
- function drawVotes()
- term.redirect(monitor)
- term.setCursorPos(2,2)
- if(wires["Purple"]) then
- term.setTextColor(colors.lime)
- monitor.write("Yes")
- else
- term.setTextColor(colors.red)
- monitor.write("No ")
- end
- term.setCursorPos(7,2)
- if(wires["Pink"]) then
- term.setTextColor(colors.lime)
- monitor.write("Yes")
- else
- term.setTextColor(colors.red)
- monitor.write("No ")
- end
- term.setCursorPos(12,2)
- if(wires["Orange"]) then
- term.setTextColor(colors.lime)
- monitor.write("Yes")
- else
- term.setTextColor(colors.red)
- monitor.write("No ")
- end
- term.setCursorPos(16,2)
- if(wires["Brown"]) then
- term.setTextColor(colors.lime)
- monitor.write("Yes")
- else
- term.setTextColor(colors.red)
- monitor.write("No ")
- end
- term.setCursorPos(21,2)
- if(wires["Blue"]) then
- term.setTextColor(colors.lime)
- monitor.write("Yes")
- else
- term.setTextColor(colors.red)
- monitor.write("No ")
- end
- term.setCursorPos(2,4)
- if(wires["Green"]) then
- term.setTextColor(colors.lime)
- monitor.write("Yes")
- else
- term.setTextColor(colors.red)
- monitor.write("No ")
- end
- term.setCursorPos(7,4)
- if(wires["Yellow"]) then
- term.setTextColor(colors.lime)
- monitor.write("Yes")
- else
- term.setTextColor(colors.red)
- monitor.write("No ")
- end
- term.setCursorPos(12,4)
- if(wires["White"]) then
- term.setTextColor(colors.lime)
- monitor.write("Yes")
- else
- term.setTextColor(colors.red)
- monitor.write("No ")
- end
- term.setCursorPos(16,4)
- if(wires["Black"]) then
- term.setTextColor(colors.lime)
- monitor.write("Yes")
- else
- term.setTextColor(colors.red)
- monitor.write("No ")
- end
- term.setCursorPos(21,4)
- if(wires["Gray"]) then
- term.setTextColor(colors.lime)
- monitor.write("Yes")
- else
- term.setTextColor(colors.red)
- monitor.write("No ")
- end
- end
- --Start main function
- if monitor then
- term.write("Voting system by Jemo_Eder")
- drawVoterColors()
- updateWireState()
- drawVotes()
- term.setCursorPos(1,1)
- monitor.setCursorBlink(false)
- while true do
- os.pullEvent("redstone")
- updateWireState()
- drawVotes()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement