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

How I can get this to work ?

Started by Vaio, 24 August 2013 - 09:55 PM
Vaio #1
Posted 24 August 2013 - 11:55 PM
So I followed 2 guides today for doors and alarms, after that, I tried to make a light switcher in my pc connecting redstone in redstone lamps across my house. I'm totally new to this,made the code myself alone and I can't spot the error in my code, can someone help ?

Spoiler
term.clear()
term.setCursorpos(1, 1)
print"Do you want to turn the lights on or off?"

input = read()

if input==(on) then
print"Lights are ON"
redstone.setOutput("back", true)
end

if input==(off) then
print "Lights are OFF"
redstone.setOutput("back", false)
sleep(3)
os.shutdown()
end

It doesn't show any error messages or anything, just don't send the redstone signal

Thanks in advance!

And the redstone wiring is correct, I tried with levers and it worked
Lyqyd #2
Posted 25 August 2013 - 01:09 AM
Split into new topic.

You need to compare the input to a string:


if input == "on" then
Vaio #3
Posted 25 August 2013 - 01:23 AM
It worked, many thanks for this, so obvious :P/>

I'm glad it wasn't anything major, the code was almost correct

And english isn't my first language, I apologize any mistakes