script will not execute in order written

Posted by Babochka on Sat 05 Nov 2005 11:53 AM — 3 posts, 17,473 views.

USA #0
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
Australia Forum Administrator #1
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.
USA #2
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.