how do i pull back a sent command from the mud

Posted by Carltheprogrammer on Wed 30 Mar 2016 12:44 PM — 5 posts, 20,038 views.

#0
I play this mud where you have to manually block attacks after 2-3 seconds and that is working fine , but the problem is that users can 'fake' an input around 2.6-3.0 seconds and then the command is sent late. I was wondering if there was a way to pull back a previous command from a mud.
Here is an example of one of my auto block triggers
<triggers>
<trigger
enabled="y"
match="*begins a elbow charging motion... *"
send_to="12"
sequence="100"
>
<send>Execute ("empty_queue")
Number = GetVariable("Number")
DoAfter (Number, "parry high")</send>
</trigger>
</triggers>
USA Global Moderator #1
What do you mean by pull back a previous command?
#2
as in replace or cancel the command sent to the mud
USA Global Moderator #3
Carltheprogrammer said:

as in replace or cancel the command sent to the mud
Ah. I see. The answer is complicated so let me start with a little story...

My mom really likes getting postcards from me, because I live in another country right now.
So every day I drop a new postcard off at the post office. There the attendant smiles, takes my postcard, walks over to a truck, puts the postcard on the truck, and the truck then drives away from the post office and over to the airport. The truck driver takes my postcard, puts it on an airplane, and then the plane takes off on its way to my mother, where a very similar process happens on her end but in reverse.

Now one day I was on my way home from the post office and I suddenly realized that I'd made aterrible error in my postcard. Now I don't like anyone seeing me make errors, not even my mother! So I decided that I needed to go and retrieve my postcard before th... Oh no! I saw the attendant put my postcard on the truck, and then I saw the truck leave. So the truck is on its way to the airport to put the postcard on the airplane. Maybe it's even already there! Oh no! I'd better drive REALLY FAST to the airport to catch my postcard before it gets on the plane! I hope I can get there in time!

So I finally get to the airport and I can see the truck! I can see the driver loading my postcard on the airplane!
IT'S NOT TOO LATE!
I'M RUNNING!
I'M RUNNING!
JUST A LITTLE FARTHER! I CAN MAKE IT!
"STOP! DON'T TAKE MY POSTCARD!"
THEY'RE LOOKING AT ME! I CAN TELL THEY'RE GOING TO STOP!
I CAN TELL I'VE MADE IT!
*boom*
AHHHH! THEY SHOT ME! RIGHT THROUGH THE LEGS! I'M BLEEDING!
THEY'RE NOT GOING TO STOP!
I DIDN'T MAKE IT!
OH GOD! THERE'S SO MUCH BLOOD!
IT'S ALL OVER!
GOODBYE CRUEL WORLD!
Australia Forum Administrator #4
Sorry to hear of your loss, Fiendish. :(


Meanwhile, as I understand the question, after a certain attack you want to queue up a block 3 seconds later, but want the option of cancelling it maybe 2.5 seconds later (ie. 0.5 seconds before it it sent)?

I think that is easy enough to do. DoAfter basically sets up a temporary timer. So instead of DoAfter, make your own timer (see AddTimer), and give it a name. Set it to send whatever it is you want after 3 seconds. Make it a one-shot timer so it doesn't keep sending it.

Then if you realize (before it does its stuff) that you want to cancel it you just delete the timer.

Template:function=AddTimer
AddTimer

The documentation for the AddTimer script function is available online. It is also in the MUSHclient help file.



Template:function=DeleteTimer
DeleteTimer

The documentation for the DeleteTimer script function is available online. It is also in the MUSHclient help file.