Posted 18 May 2014 - 10:59 PM
I would like to program a computer to do the following:
Using rednet, I have a door that accepts colors.orange and a switch for the door that outputs colors.white. I want the switch (colors.white) to cause the computer to output (colors.orange), but not if an override variable is true. With a rednet controller, this would be as simple as making a subtractor. I'm not sure where to start with Lua for this.
With my layman knowledge of lua, I would probably try something like:
But that seems pretty sketchy. What method should I use? Any help is appreciated.
Using rednet, I have a door that accepts colors.orange and a switch for the door that outputs colors.white. I want the switch (colors.white) to cause the computer to output (colors.orange), but not if an override variable is true. With a rednet controller, this would be as simple as making a subtractor. I'm not sure where to start with Lua for this.
With my layman knowledge of lua, I would probably try something like:
if switch_signal then
if door_signal then
if override then
door_signal = false
end
else
if not override then
door_signal = true
end
end
end
But that seems pretty sketchy. What method should I use? Any help is appreciated.
Edited on 18 May 2014 - 09:28 PM