ID:138083
Apr 24 2001, 8:22 am
|
|
Could someone please tell me how to properly use the call() proc to call something? I can't seem to get it to work.
|
In response to Deadron
|
|
On 4/24/01 12:45 pm Deadron wrote:
On 4/24/01 12:22 pm Manifacae wrote: I do, but I never actually use it, so I'm not certain if I'm right. As far as I know, call() has to be target on something with arguments; that is, an implicit/explicit source for a verb won't work. I.e. the following obj/verb/drop() set src in usr src.loc = usr.loc ... proc/Test() call(/obj/verb/drop)() might not work, since it doesn't know which obj to drop. But the following: mob/verb/drop(obj/O in usr) O.loc = usr.loc ... proc/Test(obj/O) call(/obj/verb/drop)(O) might. I have no idea, I nominate Guggy too. =) |
On 4/24/01 12:22 pm Manifacae wrote:
Could someone please tell me how to properly use the call() proc to call something? I can't seem to get it to work. There are two forms. In one, you make a direct call to a procedure as though it were a global unattached procedure. By unattached, I mean it does not have a src object. That form works like this: proc/Proc1(A,B) return A + B mob/verb/test() usr << call(/proc/Proc1)(3,4) //should display 7 The second form of call() is where you want to call a procedure (or verb) attached to an object. In that case, you access the proc by name rather than by its path in the code tree. mob proc/Proc1(A,B) return A + B verb/test() usr << call(src,"Proc1")(1,2) //should display 3 In this case, all the normal rules of inheritance apply, so if the object overrides Proc1, the overridden definition takes effect. In the global proc case I mentioned first, you are calling a specific procedure in the code tree, so inheritance has nothing to do with it. Hope that helps. --Dan |
I nominate Guy. I never really understood it either but he seems to.