Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
HombreDeSaiya
Newbie


Joined: 12 Oct 2002
Posts: 2

PostPosted: 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?
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: 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
Reply with quote
HombreDeSaiya
Newbie


Joined: 12 Oct 2002
Posts: 2

PostPosted: Sat Oct 12, 2002 9:26 pm   
 
What does the #noop do?
Reply with quote
iljhar
GURU


Joined: 10 Oct 2000
Posts: 1116
Location: USA

PostPosted: 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
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
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

© 2009 Zugg Software. Hosted by Wolfpaw.net