ID:142457
 
Code:
mob 
Login()
if(usr.name == key)
usr.name = input("Some text",
"Set your name",
usr.name)
if(usr.race=="undefined")
usr.race = input("More text",
"Choose your race",
usr.race) in list ("Test1","Test2")
if(usr.race=="Test1")
usr.race = input("Even more text",
"Select Test Type",
usr.race) in list("Test3", "Test4","Test5")
if(usr.race=="Test3")
usr.race = input("More TEXT!!!",
"Test3",
usr.race) in list("Yes","No")
if(usr.race=="Yes")
usr.race="Tst3"
else
return Login()
var
race = "undefined"


Problem description:

If you select "No" from Test 3, it does NOT return you to Login, unless your Key matches your name, I have tried, but have not been able to come up with a solution.

(Also, yes, I've just began to program, which is why I am asking such a question... I'm quite sure there is a simple problem.)


return stops the execution of the current proc and returns the value of Login().

mob
Login()
if(usr.name == key)
usr.name = input("Some text",
"Set your name",
usr.name)
if(usr.race=="undefined")
usr.race = input("More text",
"Choose your race",
usr.race) in list ("Test1","Test2")
if(usr.race=="Test1")
usr.race = input("Even more text",
"Select Test Type",
usr.race) in list("Test3", "Test4","Test5")
if(usr.race=="Test3")
usr.race = input("More TEXT!!!",
"Test3",
usr.race) in list("Yes","No")
if(usr.race=="Yes")
usr.race="Tst3"
else
.() //Call Login()
var
race = "undefined"
In response to Jemai1
Never mind, I fixed it, I forgot to include this in my code...

else
usr.race="undefined"
.()


Src is safer than usr to use in mob/Login()

Also, for simple yes/no questions, I would use alert() instead of input()
In response to XeroXen
This problem could have been avoided if you had used a seperate variable for the selection, rather than the mob's race variable (generally not a good idea to do that ever, unless you know what you're doing).

var/selection = input("blah") in list("test1","test2")
if (selection == "test1")
selection = input("blah") in list("test3","test4")
if (selection == "test3")
selection = input("blah") in list("Yes","No")
if (selection == "Yes")
race = "Test3"
else
return Login()
Something like this should be written in a while() loop, like so:

var/selectionisvalid = 0
while(!selectionisvalid)
prompt_for_selection()
if(selection is okay)
selectionisvalid = 1