Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ Jscript ➜ Command Precedence

Command Precedence

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Devlex   (1 post)  Bio
Date Wed 29 Mar 2006 04:28 PM (UTC)
Message
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)
Top

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #1 on Thu 30 Mar 2006 12:04 AM (UTC)
Message
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".

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


10,717 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.