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

bios:206: [string "xxxx"]:4: '=' expected

Started by Sliqs, 01 September 2012 - 12:53 PM
Sliqs #1
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
BigSHinyToys #2
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
Kazimir #3
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
KaoS #4
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 :)/>/>
Sliqs #5
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
BigSHinyToys #6
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