ID:170979
 
The topic says it all: Is "usr" acceptable in Datum procs, or would I have to use mob/M in (List)?

Also, how would I go about saving members in a guild system if i'm using datums? (I mean like, Load at startup, Save at shutdown?)
Lenox wrote:
The topic says it all: Is "usr" acceptable in Datum procs, or would I have to use mob/M in (List)?

Rule of thumb: Never Use Usr.
Exceptions: Some verbs and Click().

That's pretty much it. :) If you are programming a proc, you can solve all issues you'll ever have without using usr. Even in most verbs, you don't need it. Src should be your first choice anywhere.

Also, how would I go about saving members in a guild system if i'm using datums? (I mean like, Load at startup, Save at shutdown?)

Savefiles... my weak point, hehe! But if you create a savefile and have the datum well organized, it shouldn't be more difficult than "savefile << datum".


/Gazoot

In response to Gazoot
Hey, what if I try to say..
guild_system       //My datum
proc/MakeLeader(mob/M in Guildmembers)
if(members == 1)
if(M == usr)
M.verbs+=typesof(/guild_system/owner/verb)
//Yaddi yaddi blah blah rest of proc here


Would user be acceptable in that case?
In response to Lenox
No, it wouldn't be aceptable in that case. It has alot of potential to return false on
if(M == usr)
In response to Lenox
That depends. That's a relatively safe usage because you're only using it to check it against another variable.

As long as you keep in mind that usr will only equal M when M causes that proc to be called from one of M's verbs, then that should be okay. But it's probably not what you wanted to do, and its a pretty arbitrary restriction; why would you bother?

This is one of those cases where you're allowed to break the rules if you know the reasons behind them well enough. =P
In response to Crispy
See, and the only reason I want if(M == usr) is because I can't allow the players to attack themselves.

[EDIT]
Oh wait, this is the guild Datum that we're talking about, I need that because the leader can't perform SOME operations that I call in a proc on himself.
In response to Lenox
I'm slightly confused. What exactly are you trying to achieve?
In response to Crispy
Well, I'm setting up a guild system in datums, I'm trying to check to see if M is equal to the user who called the proc, aka the user who executed the verb, because the verb calls the proc(required for some parts). If it returns true, then the proc doesn't continue, if else, it goes on.
In response to Gazoot
Gazoot wrote:
Rule of thumb: Never Use Usr.
Exceptions: Some verbs and Click().

Correct rule of thumb: No put usr in procs. Ungh.

usr in verbs is just fine, unless you use your verbs in an unusual way by calling them like procs. Click() is more or less a verb by usage, so it's okay to use it there.

Lummox JR