So I have a script for my traffic control modded traffic lights. I have 3 redstone wires the computer can send a signal to. That part works. There's another redstone wire on the front, to which a night sensor is connected. It should make the lights flash yellow, which it does. But my problem is I can't get the flash to turn off, and for it to resume the cycle once the night sensor's redstone signal stops. I've tried local nightmode = false, and and night = not night, but it still won't do the job I want it to do.
The sides are: Right is red, Back is green, Left is flashing yellow (there is no steady yellow phase because it automatically turns on when both red and green are false)
Here's the script.
local night = false local nightmode = false while not night do rs.setOutput("right", true) rs.setOutput("back", false) sleep(15) rs.setOutput("right", false) rs.setOutput("back", false) sleep(3) rs.setOutput("right", false) rs.setOutput("back", true) sleep(15) rs.setOutput("right", false) rs.setOutput("back", false) rs.setOutput("left", false) sleep(3) if rs.getInput("front") then break end local night = true local nightmode = true end while not nightmode do rs.setOutput("right", false) rs.setOutput("back", false) sleep(1) rs.setOutput('left", true) --Problem below! if rs.getInput("front") == false then break end local nightmode = not nightmode local night = not night end
Edited by NewBuildmini, 26 November 2020 - 09:57 AM.