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

'Then' Expected

Started by svdragster, 23 January 2013 - 05:39 AM
svdragster #1
Posted 23 January 2013 - 06:39 AM
It keeps crying that in line 35 a 'then' is missing.

print ("Welcome to SVOS!")
print ("Please select a language!")
print ("Available: German/Deutsch; English")
lang = read()
if lang == "German" or "Deutsch" then
  print ("Waehlen sie einen Benutzernamen:")
  name = read()
  print ("Ihr Name ist "..name.."!")
  print ("Bitte waehlen sie ein Passwort:")
  passwort = read("*")
  print ("Ihr Passwort wurde gespeichert. Passwort anzeigen?")
  pa = read()
  if pa == ("ja") then
	print ("Ihr passwort lautet: " ..passwort)
  end
  print ("Wollen sie nun speichern?")
  save = read()
  if save == ("ja") then
	print ("Speichern...")
	f = io.open("startup","w")
	f:write("os.pullEvent = os.pullEventRaw\r\n")
	f:write("print(\"Willkommen "..name.."!\")\r\n")
	f:write("print(\"Bitte Passwort eingeben:\")\r\n")
	f:write("passwort = read(\"*\")\r\n")
	f:write("if passwort == (\""..passwort.."\") then \r\n")
	f:write("  print(\"Passwort richtig!\")\r\n")
	--f:write("  shell.run(\"programs\")\r\n")
	f:write("else os.reboot()\r\n")
	f:write("end\r\n")
	f:write("shell.run(\"desktop\")\r\n")
	f:close()
  else
	print ("Fehlgeschlagen..")
  end
elseif lang == "English" then -- [size=6][color=#FF0000][b]Line 35[/b][/color][/size]
  print ("Please choose a username:")
  name = read()
  print ("Your name is "..name.."!")
  print ("Please select a password:")
  passwort = read("*")
  print ("Your password is saved. Do you want to see the password?")
  pa = read()
  if pa == ("yes") then
	print ("Your password: " ..passwort)
  end
  print ("Do you want to save now?")
  save = read()
  if save == ("yes") then
	print ("Saving...")
	f = io.open("startup","w")
	f:write("os.pullEvent = os.pullEventRaw\r\n")
	f:write("print(\"Welcome "..name.."!\")\r\n")
	f:write("print(\"Please enter your password:\")\r\n")
	f:write("passwort = read(\"*\")\r\n")
	f:write("if passwort == (\""..passwort.."\") then \r\n")
	f:write("  print(\"Correct password!\")\r\n")
	--f:write("  shell.run(\"programs\")\r\n")
	f:write("else os.reboot()\r\n")
	f:write("end\r\n")
	f:write("shell.run(\"desktop\")\r\n")
	f:close()
  else
	print ("Failure...")
  end
end

I tried a lot and asked even a friend to help, but nothing worked…
I think there is an "end" missing somewhere, but I already looked a lot and nothing
remiX #2
Posted 23 January 2013 - 07:24 AM
if lang == "German" or "Deutsch" then
should be
if lang == "German" or lang == "Deutsch" then

That didn't give me an error though.
svdragster #3
Posted 23 January 2013 - 07:46 AM
if lang == "German" or "Deutsch" then
should be
if lang == "German" or lang == "Deutsch" then

That didn't give me an error though.

~_~ Thanks works now for me, too
Willibilly19 #4
Posted 23 January 2013 - 07:46 AM
I'm not getting any errors when I run the program…but if I type in "English", the German menu still comes up.



Edit* Nevermind, changing the code as remiX said fixed that