call a command from a verb

Feels like it's right on the tip of my tongue as it were, but I can't find the solution.

I have an object that's a container. By default it's open and transparent, with child objects hidden until the container is looked at.
(So when you 'look' command, the container is listed under the 'you can see', but after examining the object , what's inside becomes unhidden, so the 'you can see' part lists the container and what's in it.

That's all great.

But I want the exact same thing to happen if you use the custom verbs "look in" "move" and "look under".

So, in short, I want to call the examine function via the three custom verbs above.

Is there an easy way to do this, or do I have to build a function?

Thank you all!


You could use the parser, which acts just as if the player had typed a command:

HandleCommand ("examine box")

However, this is quite inefficient.
A more efficient way is to call the command's script directly. Commands are actually objects, which have a script attribute named "script". So in the case of lookat, it would be:

do (lookat, "script", QuickParams ("object", this))

(I used this, which refers to the object that a verb is attached to)


Log in to post a reply.

Support

Forums