Timed triggers.

Posted by Drazzen on Tue 26 Nov 2002 08:56 PM — 8 posts, 29,471 views.

#0
Is there a way to get triggers to only execute after 'x' amount of seconds have elapsed.
I play a mud where a common attack is to stun the player then follow up with a mental attack. If I cannot set the trigger to execute 2 seconds after the attack it miss-fires due to my char being stunned.

USA #1
I'm fairly certain there is a way to do this but you've failed to consider something in your timing issues. It may not be possible to launch an attack 2 seconds after your stun lands on your opponent due to the delay inherent in the stun attack.
#2
I meant that I am stunned and I need to wait 2 seconds before the trigger fires so the stun has time to wear off. The stun is a set time.
#3
Found the answer...

Per Nick (thanks Nick)...

Set the trigger to send the output to World(speedwalk delay) and the trigger will fire at the after whatever delay you have set in your speedwalk.

Canada #4
That's fine if you don't mind your speedwalk delay set to a whopping 2 seconds. Sure makes walking slow though.

A better solution is to call a script subroutine when the trigger fires. You might use a routine like this:

Sub OnStunned
  World.DoAfter 2, "blast"
End Sub

That code snippet is in VBS (Visual Basic Script).

Scripting isn't all that scary. As you can see, a mere three lines accomplishes your task. If you want more flexibility, you could set up an alias to choose on-the-fly which form of attack you want to use. Also, if you need a target, you could quickly set that as well with an alias or trigger.

These kind of things are asked for frequently here in the forums. Have a look around to learn more. :)
Australia Forum Administrator #5
Magnum is right, although trigger scripts need three arguments, like this:


Sub OnStunned (name, line, wildcards)
  World.DoAfter 2, "blast"
End Sub

#6
I am still trying to figure scripting out. I am trying to find a place to learn it so that I can begin using it. I am unsure as of yet how it ties into my trigger.
Australia Forum Administrator #7
You could make a small file with those three lines in it. Call it "myscript.vbs" and save it to disk (use Notepad to do that). Then enable scripting, language VBscript, and choose your "myscript.vbs" file as the name of the script file.

Finally, edit your trigger and enter "OnStunned" as the script routine to call if the trigger fires.