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 ➜ VBscript ➜ script will not execute in order written

script will not execute in order written

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


Posted by Babochka   USA  (21 posts)  Bio
Date Sat 05 Nov 2005 11:53 AM (UTC)
Message
To Life Immortal

Hello I created a script which will disable triggers so I can take stuff out of my pack.

<alias
match="g *"
enabled="y"
echo_alias="y"
send_to="12"
sequence="100"
>
<send>world.EnableTriggerGroup "antitheft", 0
world.send "get %1 from pack"
world.DoAfterNote 5, "enable triggers"
world.EnableTriggerGroup "antitheft", 1
</send>
</alias>

when run, the note "enable triggers comes up and the trigger group is not disabled.

g journal
get journal from pack
You take a personal journal from a canvas backpack.
put journal in pack
1410h, 1848m, 5950e, 7300w ex-You put a personal journal into a canvas backpack.
1410h, 1848m, 5950e, 7300w ex-
enable triggers

I cant get my journal to stay out to write in it. How do I make the script execute in the order which I have written it?


Thanks in Advance

Babochka
Top

Posted by Nick Gammon   Australia  (23,165 posts)  Bio   Forum Administrator
Date Reply #1 on Sat 05 Nov 2005 08:56 PM (UTC)
Message
Your problem is that in online games things don't happen instantly. When you type a command there is a definite delay before it is executed:


  • The command is sent to the MUD (maybe 1/10 second)

  • The MUD puts it into a queue and processes it (maybe 1/2 second)

  • The reply is sent back to you (maybe 1/10 second)


When, for some reason, these delays get longer we call it "lag", but there is always some delay.

So, what is really happening with your script is:


  1. You disable the "antitheft" trigger group

  2. You send "get something from my pack" to the MUD

  3. You enable the "antitheft trigger group

  4. The command is sent to the MUD

  5. The MUD processes it

  6. The reply comes back to you

  7. The antitheft code does its stuff


You need to do it a different way. For example, rather than disabling the trigger group, set a "flag" that says to the antitheft code "allow the next attempt to open my bag to work".

Then, when the bag is opened a second later, this extra code lets it be opened, and then clears the flag.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Flannel   USA  (1,230 posts)  Bio
Date Reply #2 on Sun 06 Nov 2005 09:41 PM (UTC)
Message
Actually, I think it's because he's already re-enabled his triggers when he takes his thing out of the bag.

I believe that his anti-theft thing is a trigger that puts anything back in a bag that he takes out.

His NOTE about enabling triggers happens afterwards, however the actual act of enabling the triggers happens instantly. He needs to have a DoAfter for the enabletriggergroup, as well as the note about it.

Babochka, your script IS executing how you write it. You disable, send the command to get it out of your pack, tell MC to note something in 5 seconds, then immediately reenable (immediately, in the same script, which things from the mud won't be able to intercept). The DoAfter doesn't stop the script for 5 seconds, it simply says "in 5 seconds, do this one thing" and then the rest of the script happens as if you didn't have that DoAfter.

~Flannel

Messiah of Rose
Eternity's Trials.

Clones are people two.
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.


15,522 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.