ID:155463
 
Hi there,i'm looking for the command to get the player gender,
i remember that when i tested byond for the first time,
there's a command to get the player gender,but i have forgot it.
What's the code to get the player gender?
Edit:Edited to change sex to gender.
I dont normaly give people codes but I cant be botherd getting a link to a guide for this. So here is a basic code that makes it so people can chose their gender on login.

mob
Login()
usr.icon_state = input("Sex?") in list("male","female")
usr.Move(locate(1,1,1))//location you go to on login


I had no space to put whole code in right order but this is how u do it, i will only use part of each line.

mob
Login()
usr.icon_state = input("What gender?") usr.Move(locate(1,1,1))


You may notice some code is in wrong place, I done this on purpose so that it makes you think and not copy and paste the code.
In response to King_ed
There's also a built in variable which is called gender.
Yeah,is that,the gender,is that i have forget it,
last time i used this program,was a 4 years,and i have forget.
Edit:Now i have know that to get the player gender,is to input gender,on lowercase.
Thanks for the help.
In response to Nakano15
np glad to help


Do you mind me asking what game are you making?
In response to King_ed
No offence...all you've done on these forums is ask for help. You normally don't give people code?...I'm sorry, I just got a chuckle out of that. You should probably keep it that way, considering this is only the first 10 days that you could have possibly had to start learning from a recent forum post requesting all to be done for you.

@OP:

Gender

Just check in Client/New() if they are male or female.

client/New()
if("male")
usr << "You must have male genetalia!"
else
usr << "I'm sexist, so get off my game"
..() //Continue with client/New()'s normal procedures
In response to OrangeWeapons
OrangeWeapons wrote:
No offence...all you've done on these forums is ask for help. You normally don't give people code?...I'm sorry, I just got a chuckle out of that. You should probably keep it that way.

Yeah, me too. I was just waiting so someone else could reply first.
In response to OrangeWeapons
I normaly give them a guide to read.

Im sorry if i upset any of you.
In response to King_ed
Indentation errors? Is that the best you could come up with?
In response to OrangeWeapons
OrangeWeapons wrote:
No offence...all you've done on these forums is ask for help. You normally don't give people code?...I'm sorry, I just got a chuckle out of that. You should probably keep it that way, considering this is only the first 10 days that you could have possibly had to start learning from a recent forum post requesting all to be done for you.

@OP:

Gender

Just check in Client/New() if they are male or female.

> client/New()
> if("male")
> usr << "You must have male genetalia!"
> else
> usr << "I'm sexist, so get off my game"
> ..() //Continue with client/New()'s normal procedures
>

You're weird.
And i wondered that this forum area was to ask help,and i can't help peoples if i don't know so much about the program i'm using,so,i must learn first,to help in the forums.

And i wonder that anybody here has her times of ask for help in the forums too.

Edit:And thanks for the help.
In response to King_ed
King_ed wrote:
I normaly give them a guide to read.....

Guide? Are you talking about that guide that you never read yourself?
In response to King_ed
King_ed wrote:
np glad to help


Do you mind me asking what game are you making?

Oh sorry,i didn't have read the rest of the post,
i'm doing a rpg,that will have male and female characters,and lots of character classes,with unique skills and etc,
but sorry,i can't give any other information of my game on this topic.
In response to Lugia319
Lugia319 wrote:
Indentation errors? Is that the best you could come up with?

Indentation errors, usr abuse, generic ripped narto code.
In response to TGAGC
Question.. Wouldnt it be easier just to make a proc called Gender?



mob
proc
Gender()
switch(input(usr,"Please choose your Gender","Gender")in list("Male","Female"))
if("Male")
usr.Gender="Male"
if("Female")
usr.Gender="Female"








In response to Liight
By default, when a new mob is made for a player (in client.New()), the new mob gets the same name and gender as the player's key.
In response to Liight
no usr in proc
In response to OrangeWeapons
Um i used usr and it still worked well.
In response to Liight
Liight wrote:
Um i used usr and it still worked well.

It's bad practice to use usr if it can be avoided, as usr can easily end up being null for a variety of reasons. A better way of doing it would be to pass the player as an argument to the proc to avoid null usr issues.

Something like:

proc/Gender(mob/M)
switch(input(M,"Please choose your Gender","Gender")in list("Male","Female"))
if("Male")
M.Gender="Male"
if("Female")
M.Gender="Female"

And call it with Gender(mob being given a gender)