Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- m = peripheral.wrap("monitor_0")
- shutdown = false
- forwardOn, backOn, rightOn, leftOn = true
- while not shutdown do
- --white = back
- --orange = right
- --magenta = forward
- --lightBlue = left
- --yellow = down
- --lime = up
- m.setBackgroundColor(colors.black)
- m.clear()
- m.setCursorPos(12,1)
- m.setBackgroundColor(colors.lightGray)
- m.setTextColor(colors.yellow)
- m.write("DRIVER")
- m.setBackgroundColor(colors.black)
- --buttons
- m.setCursorPos(9,2)
- m.setTextColor(colors.brown)
- m.setBackgroundColor(colors.yellow)
- m.write("Onetime")
- m.setCursorPos(18,2)
- m.write("Switch")
- m.setCursorPos(1,3)
- m.setTextColor(colors.white)
- m.setBackgroundColor(colors.black)
- m.write("Forward")
- m.setCursorPos(9,3)
- m.setBackgroundColor(colors.brown)
- m.write(" NOW ")
- if forwardOn then
- m.setCursorPos(18,3)
- m.setBackgroundColor(colors.lime)
- m.setTextColor(colors.white)
- m.write(" ON ")
- else
- m.setCursorPos(18,3)
- m.setBackgroundColor(colors.red)
- m.setTextColor(colors.white)
- m.write(" OFF ")
- end
- m.setCursorPos(1,4)
- m.setTextColor(colors.white)
- m.setBackgroundColor(colors.black)
- m.write("Back")
- m.setCursorPos(9,4)
- m.setBackgroundColor(colors.brown)
- m.write(" NOW ")
- if forwardOn then
- m.setCursorPos(18,4)
- m.setBackgroundColor(colors.lime)
- m.setTextColor(colors.white)
- m.write(" ON ")
- else
- m.setCursorPos(18,4)
- m.setBackgroundColor(colors.red)
- m.setTextColor(colors.white)
- m.write(" OFF ")
- end
- m.setCursorPos(1,5)
- m.setTextColor(colors.white)
- m.setBackgroundColor(colors.black)
- m.write("Left")
- m.setCursorPos(9,5)
- m.setBackgroundColor(colors.brown)
- m.write(" NOW ")
- if forwardOn then
- m.setCursorPos(18,5)
- m.setBackgroundColor(colors.lime)
- m.setTextColor(colors.white)
- m.write(" ON ")
- else
- m.setCursorPos(18,5)
- m.setBackgroundColor(colors.red)
- m.setTextColor(colors.white)
- m.write(" OFF ")
- end
- m.setCursorPos(1,6)
- m.setTextColor(colors.white)
- m.setBackgroundColor(colors.black)
- m.write("Right")
- m.setCursorPos(9,6)
- m.setBackgroundColor(colors.brown)
- m.write(" NOW ")
- if forwardOn then
- m.setCursorPos(18,6)
- m.setBackgroundColor(colors.lime)
- m.setTextColor(colors.white)
- m.write(" ON ")
- else
- m.setCursorPos(18,6)
- m.setBackgroundColor(colors.red)
- m.setTextColor(colors.white)
- m.write(" OFF ")
- end
- m.setCursorPos(1,7)
- m.setTextColor(colors.white)
- m.setBackgroundColor(colors.black)
- m.write("Up")
- m.setCursorPos(9,7)
- m.setBackgroundColor(colors.brown)
- m.write(" NOW ")
- if forwardOn then
- m.setCursorPos(18,7)
- m.setBackgroundColor(colors.lime)
- m.setTextColor(colors.white)
- m.write(" ON ")
- else
- m.setCursorPos(18,7)
- m.setBackgroundColor(colors.red)
- m.setTextColor(colors.white)
- m.write(" OFF ")
- end
- m.setCursorPos(1,8)
- m.setTextColor(colors.white)
- m.setBackgroundColor(colors.black)
- m.write("Right")
- m.setCursorPos(9,8)
- m.setBackgroundColor(colors.brown)
- m.write(" NOW ")
- if forwardOn then
- m.setCursorPos(18,8)
- m.setBackgroundColor(colors.lime)
- m.setTextColor(colors.white)
- m.write(" ON ")
- else
- m.setCursorPos(18,8)
- m.setBackgroundColor(colors.red)
- m.setTextColor(colors.white)
- m.write(" OFF ")
- end
- --control
- event, side, x, y = os.pullEvent()
- print("Event got. Type:")
- term.write(event)
- term.write(". X:")
- term.write(x)
- term.write(". Y:")
- term.write(y)
- if event=="monitor_touch" then
- if x==3 and 8<y<16 then
- rs.setBundledOutput("back", colors.conbine(rs.getBungledOutput("back"), colors.magenta))
- sleep(1)
- rs.setBundledOutput("back", colors.subtract(rs.getBundledOutput("back"), colors.magenta))
- end
- if x==4 and 8<y<16 then
- rs.setBundledOutput("back", colors.conbine(rs.getBungledOutput("back"), colors.white))
- sleep(1)
- rs.setBundledOutput("back", colors.subtract(rs.getBundledOutput("back"), colors.white))
- end
- if x==5 and 8<y<16 then
- rs.setBundledOutput("back", colors.conbine(rs.getBungledOutput("back"), colors.lightBlue))
- sleep(1)
- rs.setBundledOutput("back", colors.subtract(rs.getBundledOutput("back"), colors.lightBlue))
- end
- if x==6 and 8<y<16 then
- rs.setBundledOutput("back", colors.conbine(rs.getBungledOutput("back"), colors.orange))
- sleep(1)
- rs.setBundledOutput("back", colors.subtract(rs.getBundledOutput("back"), colors.orange))
- end
- if x==7 and 8<y<16 then
- rs.setBundledOutput("back", colors.conbine(rs.getBungledOutput("back"), colors.lime))
- sleep(1)
- rs.setBundledOutput("back", colors.subtract(rs.getBundledOutput("back"), colors.lime))
- end
- if x==8 and 8<y<16 then
- rs.setBundledOutput("back", colors.conbine(rs.getBungledOutput("back"), colors.yellow))
- sleep(1)
- rs.setBundledOutput("back", colors.subtract(rs.getBundledOutput("back"), colors.yellow))
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement