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?)
ID:170979
![]() Nov 24 2004, 10:00 pm (Edited on Nov 24 2004, 10:10 pm)
|
|
Hey, what if I try to say..
guild_system //My datum Would user be acceptable in that case? |
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 |
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. |
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.
|
Gazoot wrote:
Rule of thumb: Never Use Usr. 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 |
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.
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