|
HombreDeSaiya Newbie
Joined: 12 Oct 2002 Posts: 2
|
Posted: Sat Oct 12, 2002 6:38 pm
Canceling a Trigger before it completes itself. |
Hi. Suppose I had a trigger that goes off when someone says hello to me. However, built into this trigger is a wait command. The trigger will wait 10 seconds before it makes me say hello back. How could I make it so that this trigger will stop itself before it goes through if the person leaves the room before those 10 seconds are up?
|
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Sat Oct 12, 2002 8:54 pm |
quote:
Hi. Suppose I had a trigger that goes off when someone says hello to me. However, built into this trigger is a wait command. The trigger will wait 10 seconds before it makes me say hello back. How could I make it so that this trigger will stop itself before it goes through if the person leaves the room before those 10 seconds are up?
Your only option is to use a state variable which gets set to true in the hello trigger and set to false in the trigger that matches them leaving.
#trigger {(%w) says to you, "Hello"} {Target.name = %1;#wait 1000;#if (@Target.present) {say %1 Hello} {#noop target not present}}
#trigger {@Target.name leaves *.} {Target.present = 0}
Because of how #WAIT works, however, I don't know how that will behave. If it doesn't work correctly, replace the hello trigger with this:
#trigger {(%w) says to you, "Hello"} {Target.name = %1;#alarm +10 {#if (@Target.present) {say %1 Hello} {#noop target not present}}}
#WAIT interferes with trigger processing (in other words, nothing processes until AFTER the #WAIT expires), while #ALARM does not.
li'l shmoe of Dragon's Gate MUD |
|
|
|
HombreDeSaiya Newbie
Joined: 12 Oct 2002 Posts: 2
|
Posted: Sat Oct 12, 2002 9:26 pm |
What does the #noop do?
|
|
|
|
iljhar GURU
Joined: 10 Oct 2000 Posts: 1116 Location: USA
|
Posted: Sun Oct 13, 2002 12:32 am |
Straight from the help file:
Does nothing! (Wow, what a powerful command). Actually, it *does* expand its parameters, so its a useful way to execute a function and throw away the result
See the #CALL command for a better way to execute function calls.
Help file is your friend! ;)
Iljhar |
|
|
|
|
|