2 posts
Posted 01 September 2012 - 02:53 PM
Need helpf with this
while not redstone.getInput("left") do
redstone.setOutput("back",right)
term.clear()
print("Keller oeffnen oder schliessen?")
print("open/close")
a = io.read ()
if a == "open" then
print("Passwort eigeben!")
b = io.read()
if b == "killer" then
redstone.setOutput("back",false)
else
if a == "close" then
print("Passwort eigeben!")
c = io.read()
if c == "killer" then
redstone.setOutput("back",right)
else
print("Falsche eingabe!")
end
bios:206: [string "xxxx"]:4: '=' expected
992 posts
Posted 01 September 2012 - 03:01 PM
I have noted the corrections in your code. If something doesn't make sense ask and i will try to clarify it
Spoiler
while not redstone.getInput("left") do
redstone.setOutput("back",true) -- you ues true meaning on or false meaning off
term.clear()
print("Keller oeffnen oder schliessen?")
print("open/close")
a = io.read ()
if a == "open" then
print("Passwort eigeben!")
b = io.read()
if b == "killer" then
redstone.setOutput("back",false)
else
if a == "close" then
print("Passwort eigeben!")
c = io.read()
if c == "killer" then
redstone.setOutput("back",false) -- same here
else
print("Falsche eingabe!")
end
end -- you messed a few ends eatch IF needs a END
end
end
end
90 posts
Location
that's no moon...
Posted 01 September 2012 - 03:02 PM
Close the condition "if" and fix the second line.
while not redstone.getInput("left") do
redstone.setOutput("back", true)
term.clear()
print("Keller oeffnen oder schliessen?")
print("open/close")
a = io.read ()
if a == "open" then
print("Passwort eigeben!")
b = io.read()
if b == "killer" then
redstone.setOutput("back",false)
else
if a == "close" then
print("Passwort eigeben!")
c = io.read()
if c == "killer" then
redstone.setOutput("back",right)
else
print("Falsche eingabe!")
end
end
end
end
end
1548 posts
Location
That dark shadow under your bed...
Posted 01 September 2012 - 03:03 PM
the problem is the second line there:
redstone.setOutput("back",right)should be
redstone.setOutput("back",true)
redstone.setOutput("right",true)
lol, double ninja'd :)/>/>
2 posts
Posted 01 September 2012 - 03:23 PM
Ok accepted now the code look like
while not redstone.getInput("left") do
redstone.setOutput("back", true)
term.clear()
print("Keller oeffnen oder schliessen?")
print("open/close")
a = io.read ()
if a == "open" then
print("Passwort eigeben!")
b = io.read()
if b == "killer" then
redstone.setOutput("back",false)
else
if a == "close" then
print("Passwort eigeben!")
c = io.read()
if c == "killer" then
redstone.setOutput("back",true)
else
print("Falsche eingabe!")
end
end
end
end
end
and the same error
992 posts
Posted 01 September 2012 - 03:39 PM
This code has been tested and works. If it fails for you there is something wrong with your Computer craft in game computer or your computer craft Install.
redstone.setOutput("back", true)
while not redstone.getInput("left") do
print("Keller oeffnen oder schliessen?")
print("open/close")
a = io.read()
if a == "open" then
print("Passwort eigeben!")
b = io.read()
if b == "killer" then
redstone.setOutput("back",false)
end
elseif a == "close" then
print("Passwort eigeben!")
c = io.read()
if c == "killer" then
redstone.setOutput("back",true)
else
print("Falsche eingabe!")
end
end
end