ID:263553
 
Code:
mob
Login()
switch(input ("Do you want to load a character?","Charmed") in list ("New Character","Load Character"))
if("New Character")
usr << "Creating a new character!"
usr.name = input("What is your name?","Charmed",null) as text
usr.team = input("What is your alignment?","Charmed") in list ("Evil", "Good")
if("Evil")
usr.class = input("What is your race?","Charmed") in list ("Dark Witch","Darklighter")
usr.loc = locate(1,1,1)
else
usr.class = input("What is your race?","Charmed") in list ("Good Warlock", "Good Demon")
usr.loc = locate(1,1,1)
if("Load Character")
usr << "Sorry, loading is coming soon! Logging you out now!"
del src


Problem description: When I compile it says I have no errors but when i play and pick good, it comes up with the choice's for evil (Dark Witch and Darklighter). What have I done wrong?

Master Scar wrote:
What have I done wrong?

-mixed usr and src usage.
-usr abuse.

In short, you need to use 'src' there only.

Also, what is causing the problem your experiencing is:
if("Evil")


That checks if a hardcoded TRUE value (any non-empty text string is a true value, of course) is true, and if so executes the code indented under it. So it always executes that code.
You are trying to use switch() syntax with no switch(). If already you'd add a switch(team) before that line, but you really just need to check the 'team' var once with an if().
In response to Kaioken
How do I solve it then?
In response to Master Scar
Well he in a way told you how to do it...

But since I'm in a good mood here you go...

mob
Login()
switch(input ("Do you want to load a character?","Charmed") in list ("New Character","Load Character"))
if("New Character")
src << "Creating a new character!"
src.name = input("What is your name?","Charmed",null) as text
src.team = input("What is your alignment?","Charmed") in list ("Evil", "Good")
switch(src.team)
if("Evil")
src.class = input("What is your race?","Charmed") in list ("Dark Witch","Darklighter")
src.loc = locate(1,1,1)
if("Good")
src.class = input("What is your race?","Charmed") in list ("Good Warlock", "Good Demon")
src.loc = locate(1,1,1)
if("Load Character")
src << "Sorry, loading is coming soon! Logging you out now!"
del src
In response to KirbyAllStar
"In a way", I have told him exactly whats wrong and how to fix it in my previous post's last paragraph. :o
Also I said there a slightly better way of doing it; since he only has 2 options he doesn't need the new second switch(), just a regular if() then an else for the 2nd option.
In response to KirbyAllStar
Thanks, all fixed! :)
In response to Kaioken
True but by my statement with "In a way" I was avoiding being rude to him, because as I said I was in a good mood... :-)
In response to KirbyAllStar
Good mood or not, it was better to not actually give him code (that he clearly just copy-pasted now) but to explain it to him and let him make the tiny effort for himself. :\
In response to Kaioken
True...

-KirbyAllStar