ID:158179
 
Alright i know how to add a HUD to my game and all. I just have a question is it possible to ask a question then add the HUD? Like i have this
switch(input("What gender are you?")in list("Male","Female")
if("Male")
new/obj/GenderM(src)
if("Female")
new/obj/GenderF(src)

But it never seems to add the HUD to the screen here is my Obj coding to.
obj
GenderM
layer = MOB_LAYER+2
icon='Hud.dmi'
icon_state="genderM"
New(client/C)
screen_loc="9,11"
C.screen+=src
GenderF
layer = MOB_LAYER+2
icon='Hud.dmi'
icon_state="GenderF"
New(client/C)
screen_loc="9,11"
C.screen+=src
Yes, it's possible to do what you want. Your issue is either that src is not a client, or you have the icon_states mixed up (seeing as you have "genderM" and "GenderF").
In response to Garthor
Alright let me double check over my work to see if i messed anything up thanks Garthor.
In response to Drehdog7
Yes he is correct, you would have to pass src.client, not just src. It is not erroring becase you set it to assume C will always be a client.

sorry bad spelling
In response to Pirion
Pirion wrote:
Yes he is correct, you would have to pass src.client, not just src. It is not erroring becase you set it to assume C will always be a client.

If the argument passed was not a client, it WOULD be throwing an error. The declared type of an argument does not serve to filter out calls to that proc.
In response to Garthor
Garthor wrote:
Pirion wrote:
Yes he is correct, you would have to pass src.client, not just src. It is not erroring becase you set it to assume C will always be a client.

If the argument passed was not a client, it WOULD be throwing an error. The declared type of an argument does not serve to filter out calls to that proc.

Drehdog7 wrote:
Alright i know how to add a HUD to my game and all. I just have a question is it possible to ask a question then add the HUD? Like i have this
> switch(input("What gender are you?")in list("Male","Female")
> if("Male")
> new/obj/GenderM(src) //passing the type that calls it, most genrally not being called under the client.
> if("Female")
> new/obj/GenderF(src)
>

But it never seems to add the HUD to the screen here is my Obj coding to.
> obj
> GenderM
> layer = MOB_LAYER+2
> icon='Hud.dmi'
> icon_state="genderM"
> New(client/C) // says the arg passed is a client with the var C
> screen_loc="9,11"
> C.screen+=src
> GenderF
> layer = MOB_LAYER+2
> icon='Hud.dmi'
> icon_state="GenderF"
> New(client/C)// says the arg passed is a client with the var C
> screen_loc="9,11"
> C.screen+=src


it doesnt throw an error when mix matching these two because C is defined as a client.
In response to Pirion
Pirion wrote:
it does throw an error when mix matching these two because C is defined as a client.

1) Your initial claim was that it would NOT throw an error.
2) What C is defined as has jack squat to do with runtime errors. An error would occur on the C.screen line if C was not a client, but that has nothing to do with the fact that C is defined as a client, and instead has to do with whatever variable you're storing in C does not have a screen variable.
3) Don't quote massive blocks of texts. We're perfectly capable of reading the threads ourselves. Only quote what is immediately relevant.