This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
VilcsiTH's profile picture

[Lua]Redstone Output

Started by VilcsiTH, 16 March 2012 - 01:13 PM
VilcsiTH #1
Posted 16 March 2012 - 02:13 PM
Hi! I'm a newcomer in Lua, and I have a problem. Me and my cousin wanted to make an RP server. We did it good, but then he came up with the idea: Let there be electricity.
So we began putting redstone all over the place and he wanted to do that: If the redstone isn't powered at the back of the computer, then the computer can't start. But, if there's redstone powered and connected to the back of the computer, then it can start.

We thought this would be good:

if redstone.output("back", false) then
os.shutdown()
end
else
if redstone.output("back", true) then
end
And then the starting would continue.(Because we want this to put into the startup)
I wanted to ask you, is this possible? If yes, then how? Please help me fast.
Liraal #2
Posted 16 March 2012 - 02:19 PM
if redstone.getInput("back") then
os.shutdown()
end
else
if redstone.getInput("back") then
return true –just for good practice :D/>/>
end
VilcsiTH #3
Posted 16 March 2012 - 02:31 PM
if redstone.getInput("back") then
os.shutdown()
end
else
if redstone.getInput("back") then
return true –just for good practice :D/>/>
end

It's smells from here, even I didn't tried it…
if redstone.getInput from back then it turns off? It needs to be when redstone.DOESN'TgetInput then it turn off.
Liraal #4
Posted 16 March 2012 - 02:32 PM
sorry, haste typing, forgot the 'not'

if not redstone.getInput("back") then
os.shutdown()
end
else
if redstone.getInput("back") then
return true –just for good practice :D/>/>
end
VilcsiTH #5
Posted 16 March 2012 - 03:29 PM
sorry, haste typing, forgot the 'not'

if not redstone.getInput("back") then
os.shutdown()
end
else
if redstone.getInput("back") then
return true –just for good practice :D/>/>
end
It says bios:206: [string "startup"]:4: '<eof>' expected even if I try this code alone.
Liraal #6
Posted 16 March 2012 - 03:31 PM
if not redstone.getInput("back") then
os.shutdown()
else
if redstone.getInput("back") then
return true –just for good practice :)/>/>
end
end

i guess i should have paid more attention to your code… :D/>/>
VilcsiTH #7
Posted 16 March 2012 - 03:33 PM
if not redstone.getInput("back") then
os.shutdown()
else
if redstone.getInput("back") then
return true –just for good practice :)/>/>
end
end

i guess i should have paid more attention to your code… :D/>/>
Thanks mate! :)/>/>