Allo.
After being yelled at by garthor a couple times about usr abuse in procs ive all but fixed that problem awhile back but another little query has come to mind after awhile since i didn't really go into large scale verb creating and im using the verb package system thats supplied by Jtgibsons forum.
ive gone into proc related verbs for my admin and guild packs.
now since there procs but are technically in the long run verbs does the no usr in procs apply to this case or does it cancel out?
if it does apply what methods are there that are available to counter this rule
Thanks
~midget
ID:151489
![]() Aug 23 2010, 1:36 pm
|
|
hmm i thought my english was quite good on explaining it. maybe my head just works a bit different arr well.
Anyways i know how it all works so the snip was somewhat of a pointless thing but thanks for putting the time in to respond anyway. the reason i asked was mainly because (this is what a basic verb would look like if i used usr in the proc that gets turned into a verb) guild as you can see this is a proc in the guild datums that uses usr in a proc for the sake of displaying the sender and what not. but since that would be converted to a verb by the verbpackager the point of the thread becomes is that an ok form of putting usr in a proc or not. |
usr should only be used in neccesary cases such as the Click proc, in my case i dont use them in verbs OR procs at all unless im just doing some quick test thing and overlook(which rarely happens) what im typing :P
|
yeah i usually use src aswell but since in the case of this src cant be used as the proc that is transferred into a verb is inside a guild datum as opposed to a mob/proc.
so src becomes null and void due to the datum. |
That's what proc arguments are for, if src isn't valid then you should be passing what you need to the proc when you call it.
|
If the only purpose of a proc is to later be added to a player's verbs list, it's fine to use usr in it, because it really is just a verb by another name. However, I'd strongly suggest using a more modular approach than mucking around with verbs lists., such as using objs in contents instead.
|
In all honesty this is a little bit of a gray area. The key thing, above all else, is to be sure that if you do use usr, it's used correctly. If you have procs that are extremely verb-like, and are only ever called by verbs, usr may be justified there. The thing is, it's kind of a slippery slope, so if you do this you should be darn careful.
If you've had usr issues in the past though, I recommend extreme caution and passing the acting mob as an argument in all cases. Better to learn how to do it the strict way. Lummox JR |
The only case where the Eat proc would be incorrect, is if you have a player force-feeding another.
Because of the way that usr is passed along within the arguments of a function, it is generally safe. However, it doesn't mean that it's proper to use it, so you are right in theory, just wrong in all but the most obscure situations. I strongly dislike the "no usr" argument, because a sense of tribal knowledge has come to surround the entire subject because of mostly vague or incorrect information being thrown around. But Lummox said it already, it's a slippery slope, and when a system goes from being simple to complex, it can cause some pretty severe issues. |
The REASON you don't use usr in procs normally is because of logic; DM won't magically know who usr is if there's more than one player online. An example of this would be:
This is extremely wrong because in some cases there will be no usr calling the proc and you will most likely face a lot of difficulties with your code in a populated server. It's better to define SPECIFICALLY who's eating the food.
Now that's much better! Here we use a variable, fatman, to reference who exactly is eating the food. What you should keep in mind is that in most verbs it's okay to use usr because it's virtually impossible for one player to call another's verb. The same applies for client procs and mouse functions.