Command Precedence

Posted by Devlex on Wed 29 Mar 2006 04:28 PM — 2 posts, 11,474 views.

#0
I have a scripting function that uses send to move me somewhere(world.send("north");) etc, and then when it finishes moving I need to enable a trigger group. Basically something like this:

world.send("north");
world.send("north");
world.enabletriggergroup("group", 1);

Problem is, it sends all the directions and then enables the group all at the same time. The triggers get enabled before it finishes moving. I've tried messing around with queue and execute but i haven't had any luck. Anyone have any techniques? (Sorry if this has been posted before, I did try searching)
USA #1
The problem is that world.send("north") considers itself to be "done" as soon as the input is sent to the MUD, and not when the MUD has actually moved you. So the script is indeed doing the 'correct' thing, at least as far as it's concerned.

There are a number of solutions:
1- have a timer that only enables the trigger after some "reasonable" amount of time (it is up to you to determine how long is "reasonable")
2- have a second trigger that you use to recognize when the movement is over, and use that to enable the trigger group.


Here's one thing you could do:
world.enabletriggergroup("inv-trigger");
world.send("north");
world.send("north");
world.send("inventory");

And then have a trigger that belongs to the group "inv-trigger", and matches on the inventory text; that trigger would then turn off "inv-trigger" and turn on "group".