Posted 16 January 2013 - 03:38 AM
Hi, Im trying to make a program that when i press 1 it should give a redstone signal, when i press 2 it should turn it off. I got a code but i can't get it to work.
There might be some spelling errors in that one because if wrote it off the screen, im on a server so i can't copy. And where it says redstone signal on/off i got the real code but i just wrote that for you to understand it better.
The error i get when i try to run the code is 12: 'end' expected (to close 'while' at line 2)
I Have added end there but it don't work. Don't know if it matters but im playing on a 1.2.5 server with tekkit. So computercraft is version 1.3
Thanks :3
print(" 1 = on, 2 = auto:")
while true do
term.setCursorPos(1,2)
term.clearLine()
if read() == "1" then
redstone signal here
print(" ON ")
sleep ( 1 )
return
end
elseif read() == "2" then
redstone signal off
print (" auto ")
sleep ( 1 )
return
end
end
print("Enter a number.")
sleep(2)
term.clearLine()
end
end
There might be some spelling errors in that one because if wrote it off the screen, im on a server so i can't copy. And where it says redstone signal on/off i got the real code but i just wrote that for you to understand it better.
The error i get when i try to run the code is 12: 'end' expected (to close 'while' at line 2)
I Have added end there but it don't work. Don't know if it matters but im playing on a 1.2.5 server with tekkit. So computercraft is version 1.3
Thanks :3