ID:163708
 
Is there a way to force a mob to use a verb without changing the verb into a proc or using a proc, just make it use it as if the client them self had used it.
The best way is usually to have a proc. You can call the proc directly, and have your verb call the proc.

However, if this won't work for you, you should be able to call the verb just like you would a proc. However, some things, especially usr, will break.
Uhh...

usr.Verb()
In response to Kaiochao2536
if the "usr" will break in the verbs, which I understand, would it be easier to replace all the usr's in my verbs with a var/mob/U = usr or a var/mob/U = src I assume the first one won't work, but just putting it out there.
In response to SS10trunks
Is there any real difference?
Yes.

mob/verb/hello() usr<<"Hi!"

proc/force_press_hello(mob/M)
usr=M
M.hello()


That should work. I remember that I used it before.

-- Data
In response to Android Data
thanks guys I appreciate the help, especially Android Data. It did work and saved me quite some time.
To clarify Jon88's and Android Data's answers, if you're going to have your NPCs or other mobs call verbs, then you need to set usr manually before you call the verb. A verb can be called just like any other proc, but because usr is expected to be valid there, you need to be sure you're supplying it with a good value.

That's why AD suggested you set usr first. If you do that, then usr won't "break" inside the verb. But if you call the verb without setting usr, there's no telling what will happen.

One thing to look out for, though, is that you can't use any verb this way that relies on input() or alert(). Those will seriously break, because you have to have a valid client to send an input/alert box to. In regular verbs this doesn't matter, but if you're using the verb like you'd use a proc, there is no guarantee that usr.client is valid.

Lummox JR