ID:179797
 
I know I've seen various references, and hints on how to do this but so far I have not found the code I'm looking for. I'm having problems adding to my current code which has the default player set to PC. But what I'd like to do is add in addition to the pc, a menu that ask u, "Male/Female" when u enter the game, then depending on which u choose your character will be given the correct icon. I see lots of games with this, but I can't see their code.

Any suggestions? Code? Tutorial? Demo, where I can see how the code is written?

LJR
Well!! ;) A here is a rare occasion.. A newbie who answers his own question, and posts the results for anyone else with the same question. I have a back ground in C, C++ so I just applied that kind of logic here and came up with something that works!!

---------------------------------------
mob/Login()
usr.name = input("What is your name?") as text // text prompt
usr.gender = input("What is your gender?") in list("male","female")

if (usr.gender == "male") icon = 'pc.dmi'
else if (usr.gender == "female") icon = 'pc-girl.dmi'
else icon = 'pc.dmi'

return ..()
---------------------------------------

LJR
Creator of the RPG, "Kemet"
In response to LordJR
Bravo!!!! With an attitude and initiative like that, I'm sure you'll go far. Here's a tip on efficiency:

if (src.gender == "female") src.icon = 'pc-girl.dmi'
else src.icon = 'pc.dmi'

will do the exact same thing as your code, but it is one line shorter!