|
Togakure Newbie
Joined: 12 Jan 2003 Posts: 3 Location: New Zealand
|
Posted: Sun Jan 12, 2003 3:41 am
Getting a trigger to wait before firing again |
I've got a pattern-matching trigger that triggers on prompt, recording a bunch of variables. It also contains an IF statement to perform an action if a variable condition is met. However, I want the variable-loading trigger to keep going off but I want the IF statement to not fire for a period of about one or two seconds so as to not spam the mud during combat (command only needs sending once). How do I manage this? Use aliases as well? Which additional commands would I need? How?
Thanks.
Thought for the day: If a parrot and a tuna got married, would they have flying fish for children? |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Sun Jan 12, 2003 4:15 am |
A good solution for this is to use a control variable, where the action will only be allowed when the variable is 1. Upon doing the action, the variable is set to 0, preventing repeats until it is set back to 1.
Example:
#VAR control1 1 1
#TR {(%d)h (%d)m} {#VAR hp %1;#VAR mana %2;#IF ((%1 < 375) AND (@control1 = 1)) {#VAR control1 0;cast heal;#ALA +2 {#VAR control1 1}}} {} {nocr|prompt}
LightBulb
Senior Member |
|
|
|
Togakure Newbie
Joined: 12 Jan 2003 Posts: 3 Location: New Zealand
|
Posted: Sun Jan 12, 2003 4:33 am |
If I understand this correctly, then...
Control variable is created and set, allowing If statement to complete (assuming other conditions are true).
If statement fires (including check for control variable). If True, do actions and set control variable to 0;wait timeperiod (because of temporary #alarm);reset control variable to 1 when alarm fires.
As a consequence, the variables still keep getting updated everytime the prompt wanders by, but there is a time period where the If statement gets disabled every time that fires.
I follow it that far, but am not sure what function the "{} {nocr|prompt}" fulfils, but suspect it is just there for tidyness.
Is my understanding correct?
Thought for the day: If a parrot and a tuna got married, would they have flying fish for children? |
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Sun Jan 12, 2003 4:44 am |
quote:
If I understand this correctly, then...
Control variable is created and set, allowing If statement to complete (assuming other conditions are true).
If statement fires (including check for control variable). If True, do actions and set control variable to 0;wait timeperiod (because of temporary #alarm);reset control variable to 1 when alarm fires.
As a consequence, the variables still keep getting updated everytime the prompt wanders by, but there is a time period where the If statement gets disabled every time that fires.
I follow it that far, but am not sure what function the "{} {nocr|prompt}" fulfils, but suspect it is just there for tidyness.
Is my understanding correct?
Thought for the day: If a parrot and a tuna got married, would they have flying fish for children?
Yep, quite astute of you. "{} {nocr|prompt}" is part of the #TRIGGER syntax:
{} -- this is the part where you specify what class it goes into (otherwise it gets created in the current or None class)
{nocr|prompt} -- this the part where trigger options are specified. In this specific example, it denotes a Trigger on Prompt option.
li'l shmoe of Dragon's Gate MUD |
|
|
|
Togakure Newbie
Joined: 12 Jan 2003 Posts: 3 Location: New Zealand
|
Posted: Sun Jan 12, 2003 4:53 am |
Many thanks, I've enough clues to go on now to get that trigger firing correctly. Now to go test it (hopefully without dieing) *grin*
Thanks.
Togakure |
|
|
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|