ID:158836
Jun 22 2009, 6:51 am
|
|
Is there any way to immediately disble all verbs for the user without using verbs -= typesof(/mob)?
|
the shortest way to disable something would be like this
mob/verb/Tackle() |
In response to Mista-mage123
|
|
Use Boolean logic in cases like this, silly ;)
// if the var is set to null or "", since it's not ==0 it'll pass the check. |
In response to Ruben7
|
|
You forgot the "else" of that if statement. my post would be the easiest/shortest because even though its an if, the way its coded, it doesnt need an else.
|
In response to Tatenen
|
|
No, I didn't. It automatically returns null if nothing is defined. My post is basically what you said, I was just pointing that out to Mista.
|
In response to Tatenen
|
|
I would say that using return instead of a properly-formatted if() statement is neither easier nor shorter. It obfuscates the flow and while I don't buy into the "only one procedure exit point" school of thought, I wouldn't throw return all over the place without a good reason to.
|
To disable them, just put in a check at the start of each verb that checks to see if it's disabled, and, if so, doesn't execute the verb.
/mob/verb/Say(T as text)
if(usr.thisisdisabled==0)
world << T //An example
Removing the verbs is an entirely different manner, but with the way you phrased the question, it's as if you don't want to remove them, but to "disable" Them, so the above will fulfill that.