ID:158889
Jun 15 2009, 6:12 am
|
|
In on my codes, I was told that I shouldn't usr and that it would cause problems, why is that?
|
Jun 15 2009, 6:16 am (Edited on Jun 15 2009, 6:28 am)
|
|
In certain cases usr isn't what you call the proc on (src always is), and in some cases it can be null.
|
They Say not to use usr and to use src only when (They both are the same). Because in some cases the src is not the usr. On some cases usr is null. You can / should rely on src if they are both the same.
|
In response to Getenks
|
|
Getenks wrote:
They Say not to use usr and to use src only when (They both are the same). Because in some cases the src is not the usr. On some cases usr is null. You can / should rely on src if they are both the same. Actually, they are NOT the same. usr = user = The mob who DIRECTLY calls the procedure/verb. (This means that indirect procedures, such as Bump() and Move(), may not have usr defined and should definitely not use usr). src = source = the object which has that verb/procedure (ex: the src of /obj/apple/verb/Eat() would be that /obj/apple object) Another example of usr/src being different is here: mob/Click() usr = the person who clicked the /mob src = The mob clicked (who has that procedure called from) http://www.byond.com/members/ DreamMakers?command=view_post&post=35932 <-- Tells you where usr is considered to be safe. |
ID:702919
-Don't use something before you actually know what it means and how it works. To read about usr, check out the link GhostAnime read, and usr's DM Reference entry. -usr doesn't cause always cause problems whenever you use it. It's simply unreliable to use in (most) procs, as its value can be potentially arbitrary (including null) in procs. |