ID:167094
 
Can someone explain to me how to use Switch() and List() to make a Login() with asking questions.. i had
Login()
Switch(input("Whats your gender?","Gender") in list ("Male","Female"))
if ("Male") src.icon = 'male.dmi'
else src.icon = 'female.dmi'
..()

That doesnt work so can someone explain and help..

lowercase the S in switch
First off its switch not Switch

Login()
switch(input("Whats your gender?","Gender") in list ("Male","Female"))
if ("Male") src.icon = 'male.dmi'
else src.icon = 'female.dmi'
..()
In response to A.T.H.K
A.T.H.K wrote:
First off its switch not Switch

second... usr abuse
third indentation.

There Fix'd.


> Login()
> switch(input(src,"Whats your gender?","Gender") in list ("Male","Female"))
> if ("Male") src.icon = 'male.dmi'
> else src.icon = 'female.dmi'
> ..()
>
>


I personally would not use switch() for something that only has two things to select.

and if() and alert() would work better.

mob/Login()
if(alert(src,"Race","race selection","Male","Female")=="Male")
src.icon = 'male.dmi'
else
src.icon = 'female.dmi'
..()


In response to Crzylme
second... usr abuse? i see no usr abuse?
In response to A.T.H.K
The receiver of the alert or input defaults to usr, so you have to manually send it through the first argument.

~~> Unknown Person
In response to A.T.H.K
That is why you aren't ready to yell at people when they are wrong.

input, alert, view, oview, range, orange all default to usr, you have to send the argument who the receiver is.
In response to A.T.H.K
look again.

http://www.byondscape.com/ascape.dmb/LummoxJR.2002-1104/


Login() is one of those procs you don't use usr in.

In input() usr is the default recipient. you must change that to src.
In response to Justin B
usr is safe enough in Login(). I highly doubt he's going to be calling it manually.
In response to Unknown Person
Unknown Person wrote:
The receiver of the alert or input defaults to usr, so you have to manually send it through the first argument.

~~> Unknown Person


oopz we all make mistakes and when you haven't sleept for 3 days i guess anyone could
In response to Airjoe
Its better to be one the safer side...
In response to Airjoe
If he is using src for everything else, he might as well create a good habit by putting src in the arguement too.
In response to Justin B
Justin B wrote:
If he is using src for everything else, he might as well create a good habit by putting src in the arguement too.

I'm not saying it wouldn't be good habit, I'm just saying (and not specifically to you) that there's no reason to jump on him for "usr abuse".
In response to Airjoe
Reboot() calls it.
In response to Jp
Jp wrote:
Reboot() calls it.

Yes, but doesn't it get called as it would normally, making usr safe? Reboot doesn't just 'reset' the world, it actually reboots, and every logs in 'naturally'. Isn't it the same as shutting down the game entirely and then opening it back up?
In response to Jp
Jp wrote:
Reboot() calls it.

Reboot reloads the world from scratch, therefore usr is safe there.
For this
    if(alert(src,"Race","race selection","Male","Female")=="Male")
src.icon = 'male.dmi'
else
src.icon = 'female.dmi'

Can i use it more then once in a row? To get the sex.. then class.. etc
In response to Grimson10
Only until the Secret Multiple-Ifs-in-a-Row Police crack down on you. Then, you better watch your back!