Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Author: crazybrain
- -- Date: 09/11/2022
- -- License: GPL v3.0
- -- Version: 1.0 (13/11/2022)
- -- Function definitions
- function rsControl(side, colour, pulse, time)
- pulse = pulse or false
- time = time or 0
- colour = colors[colour]
- current = rs.getBundledOutput(side)
- currentPlus = colors.combine(current, colour)
- currentMinus = colors.subtract(current, colour)
- if pulse then
- rs.setBundledOutput(side, currentPlus)
- sleep(time)
- rs.setBundledOutput(side, currentMinus)
- else
- if current == currentPlus then
- rs.setBundledOutput(side, currentMinus)
- else
- rs.setBundledOutput(side, currentPlus)
- end
- end
- end
- -- Visuals
- term.clear()
- term.setCursorPos(1,1)
- print("1 Main Door")
- print("2 Maintenance Door")
- term.setCursorPos(1, 10)
- print("q Quit")
- -- Main loop
- while true do
- --grabs the key inputs from
- _, eventInput = os.pullEvent("char")
- if eventInput == "q" then
- print("Program Quiting...")
- break
- elseif eventInput == "1" then
- rsControl("back", "red", true, 1)
- elseif eventInput == "2" then
- -- Maintenance Door
- rsControl("left", "white")
- end
- end
Add Comment
Please, Sign In to add comment