Hey,
I'm pretty new to ComputerCraft, just started playing around with it today. I've made a couple simple programs such as a password protected door, and a computer that controls lights, however what I have been trying for the past hour or so is a computer to control all the machines in my factory. It's pretty much done - I just can't figure out how to "add up" the bundled cable values, for example, I have 3 output cables: white, red, and orange. I can turn white on, but when I turn red on, white turns off, because the value changes to 16385 instead of 16386 for both white and red.
I know what I have to do, make it so that if white cable is on, it adds one to the red cable when I turn it on, and if white and red are on, it adds 16386 to the orange cable, so all 3 turn on. Only thing is I have no idea how to do this in Lua. I think it might involve using variables, although I am still not sure.
If you could help it would be much appreciated, so close to finishing this and now I'm stumped right at the end
Code: http://pastebin.com/iAwFCbyJ
The "state" variable is when I tried to use variables to add them but I could not get it to work.