ID:150309
 
Ok I'm trying to mess a less with othre people's code as I can and just try and to adapt. One thing I can't seem to do correctly is set the usr.gender variable.

I viewed all the documentation I could find and its about worthless. Unless you were never meant to set this?

Here is what I'm trying to do.

mob/male
icon = 'pc.dmi'
usr.gender = "male"

mob/female
icon = 'pc-girl.dmi'
usr.gender = "female"

this is giving me a error:usr.gender:bad var

how am I to do it then?
Try taking out the usr part.
In response to Nadrew
Having usr in the mob decleration makes no sense. It's like a design for a car having "driver" as a part of the car, like the windshield. The driver gets put into the car after they buy it, not when the car is being designed... Similarly, the usr is put into the mob when a player logs in and is placed into the mob, not when the mob is being designed.
In response to Nadrew
ah man.. thanks.. it was sooo easy too :-P

hmm ok looks like I'm a on roll.. if anyone reads anything about my bout with gender from before this message, ignore.. I'm moving on!!!!!!!!!1
In response to GateGuardian
Using usr and src

  • usr
    Usage in verbs as the user of the verb.

    • src
      Usage in procs such as Login() and any other proc that is attached to a mob.

      As the target of a verb as in "you attack [src]" but you have to check if the src is the usr using
if(src==usr)


  • An example of both
mob
proc
Jump()
view()<<"[src] jumps with glee!"

Using a proc

mob
verb
Jump()
view()<<"[usr] jumps with glee!"

Using a verb


These both output the exact same thing using usr in a proc can cause some weird activity and vise versa using a verb.
In response to Nadrew
Looking it up in the reference is a good way to go too. I particularly like the line "The only time usr is assigned for you is when a player (in Dream Seeker) executes a verb, clicks something with the mouse, or any other such action."
In response to GateGuardian
GateGuardian wrote:
Looking it up in the reference is a good way to go too. I particularly like the line "The only time usr is assigned for you is when a player (in Dream Seeker) executes a verb, clicks something with the mouse, or any other such action."

hmm :(
Sad thing is I am looking in the Reference, FAQ, Guide, Quotes of people's code. But I see it from the eyes of someone new. To those of you who already know the basics it much easier, and you think, "Its soo easy!! You didn't understand that!?"

LJR
In response to GateGuardian
GateGuardian wrote:
Looking it up in the reference is a good way to go too. I particularly like the line "The only time usr is assigned for you is when a player (in Dream Seeker) executes a verb, clicks something with the mouse, or any other such action."

Thing is, this is not exactly true. Usr is the caller of a verb or proc. It's just not documented that way. Try this:

mob
chauncy
proc/smackeroo()
world << "I was smackerooed by [usr]!"

henry
New()
(for var/mob/chauncy/C in world)
C.smackeroo()


In response to Nadrew
Nadrew wrote:
using usr in a proc can cause some weird activity and vise versa using a verb.

Usr is useful in a proc if the proc is called from a mob within your game, and you know what you're doing. See my post below.
In response to Skysaw
Yeah, well, a proc and a verb are basically the same thing only verbs start in the verb list and procs don't! So there.

I understand how it works, but I'll cease trying to explain it now...