I'm still having trouble coding the verb to allow me to order mobs to do things. If someone could post a small snippet just illustrating how to get one mob to order another to do something. Right now my code pops up everything like it should, one for the verb, one for the argument, but it causes the usr to execute it rather than the M.
Heres my code:
verb/order(mob/M,T as text,trg as text|null)
set category = "Immortal"
usr << "You order [M] to \"[T]\"."
M << "[usr] orders you to \"[T]\"."
var\mob\O
for(O in oview())
if(O != M)
O << "[usr] orders [M] to \"[T]\"."
call(M,T)(trg)
ID:138483
Jul 19 2000, 7:03 pm
|
|
In response to Tom H.
|
|
Thanx for the snippet, I think part of it was that all my verbs were based on usr rather than src, but now it doesn't do anything at all when I order a mob. I think I'm using the call proc in the wrong way. It doesn't seem like its designed to cause the M to perform the action, its more for the usr to perform a verb that belongs to M. For instance if a cow had the verb moo, I could have my immortal perform this verb without actually owning it. If this is the case I need a different way of coding this, if I figure it out I'll post it.
|
In response to DerDragon
|
|
On 7/21/00 4:43 pm DerDragon wrote:
Thanx for the snippet, I think part of it was that all my verbs were based on usr rather than src, but now it doesn't do anything at all when I order a mob. I think I'm using the call proc in the wrong way. It doesn't seem like its designed to cause the M to perform the action, its more for the usr to perform a verb that belongs to M. For instance if a cow had the verb moo, I could have my immortal perform this verb without actually owning it. If this is the case I need a different way of coding this, if I figure it out I'll post it. If you don't want to reorganize your verbs to use src, I belive that you can just explicetly set usr before the verb is executed, eg: usr = M call(M)(...) See if that works. Post some code if you have questions. |
This code looks okay to me. When I test it with a similar example, it seems to work correctly. Note that inside the proc named "T" the usr will still be the caller of the "order" proc, but the src will be M.
To clarify, here's the example I'm using:
mob
Login()
new/mob
verb/callme()
world << "src=[src], usr=[usr]"
verb/test()
var/mob/M
for(M in world)
call(M,"callme")()
When I run it, the output is:
src=Tom, usr=Tom
src=the mob, usr=Tom
Does that make sense?