I'm wondering if their is a way to poll for the person's key's Gender when they enter a game. If so whats the syntax for this?
LJR
ID:154202
Apr 8 2002, 7:33 am
|
|
In response to Lesbian Assassin
|
|
client.gender is the same as the Key's Gender right? As in what u have selected under your Key's profile here at BYOND.
LJR |
In response to LordJR
|
|
In response to Foomer
|
|
I'm not sure if you guys see what I'm trying to do. I have some code now and even though I have Male as my Key, this code here is not reconizing it.
if(client.gender=="male") How do I poll the key's gender with an if statement and do something if this or that? LJR |
In response to LordJR
|
|
You have to tell it what client to check.
if(src.client.gender == "Male") Or you could replace src with usr for verbs. Hope I helped -Rcet |
In response to Rcet
|
|
Rcet wrote:
You have to tell it what client to check. > if(src.client.gender == "Male") Or you could replace src with usr for verbs. No you don't. src is implicit for all variables. In other words: src.client == client |
In response to LordJR
|
|
LordJR wrote:
I'm not sure if you guys see what I'm trying to do. I have some code now and even though I have Male as my Key, this code here is not reconizing it. A client has a gender. A client also has a key. A key does not have a gender. |
In response to Skysaw
|
|
Skysaw wrote:
No you don't. src is implicit for all variables. In other words: Hmm. Whenever I just do client.var, it won't compile, I always have to do src.client, or usr.client. -Rcet |
In response to Rcet
|
|
Rcet wrote:
Skysaw wrote: If src.client works, so will client. Not necessarily true for usr. |
In response to Skysaw
|
|
sure it does.. just looking under ur identity on the BYOND website.. Thats what I want to know if I can get access to.
LJR |
In response to LordJR
|
|
LordJR wrote:
sure it does.. just looking under ur identity on the BYOND website.. Thats what I want to know if I can get access to. No, it doesn't. Not within BYOND's coding environment, anyway. From the reference: gender var (client) "This is the client's gender, which is an attribute of the player's key. 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..." This is not to say that there is a client.key.gender variable. There just isn't one. However, client.gender will return what you want. |
In response to Skysaw
|
|
Thanks for all ur attempt, but none of this has worked. I've tried it all. Also chatting with Leftly he wondered if I had over written client/ somewhere but its fresh code and I know I haven't. What I'm trying to do is an if then
do this with the client.gender if(client.gender=="male") then do this etc.. but I have a catch all else at the bottom and everytime I long in even though I see my Gender on the BYOND is a Male. Its giving me the else default and not the Male icon. Which is what this is for. An automatic gender icon selector for when you log in. Any clues? LJR |
In response to LordJR
|
|
LordJR wrote:
Thanks for all ur attempt, but none of this has worked. I've tried it all. Also chatting with Leftly he wondered if I had over written client/ somewhere but its fresh code and I know I haven't. What I'm trying to do is an if then Hard to know what's going on, but the best thing is to do some hardcore sanity checks. Try doing this in your check: world << "My gender is [client.gender]" That will give you a place to start. |
In response to Skysaw
|
|
oh I could kick myself! :P
I need else if instead of just another if() and then else at the end. It was changing it to the 1st and then the else! Ok I'm free of this trouble back to my TOP Secret new PROJECT, will be revealed to the community in the coming days.. ;) LJR |
In response to LordJR
|
|
I don't know what's wrong with your code (if it's in client.New(), try calling the parent proc first, because this is where your key's name and gender is assigned to your client), but yes, I know exactly what you mean, and I'm telling you, if you leave the default client initialization in place, client.gender == whatever you put when you register your key.
Haven't you noticed that if you don't make a gender selector, BYOND still automatically assigns the "right" gender to players? Or do guys just assume that male is the default gender? :P Your key identity gender >> client.gender >> mob.gender |
In response to LordJR
|
|
Um... if that's ALL you were doing with this, why didn't you just use mob.gender???
|
In response to Lesbian Assassin
|
|
Actually the default gender goes to a Robot! Clever eh?
(^_^) We're pro mecha, not bio! LJR |
In response to LordJR
|
|
LordJR wrote:
Actually the default gender goes to a Robot! Clever eh? You have something against female robots? (Or rather, fembots?) Lummox JR |
In response to Lummox JR
|
|
Lummox JR wrote:
LordJR wrote: Point being robots are genderless unless you go making them into the image of man, which is pointless unless trying to make a Mecha companion for a Bio. :P LJR |
The default login behavior IS to grab the key's name and gender and assign them to a new instance of world.mob, so in most cases, grabbing client.gender is redundant.