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
niav
Newbie


Joined: 18 Dec 2006
Posts: 4
Location: home

PostPosted: Sat Mar 10, 2007 2:12 pm   

Ignoring Triggers
 
If I have a trigger set to wait on a certain thing, and the same thing goes off twice in a row, is there a way to just ignore the first trigger all together and only continue with the second one?
Reply with quote
Progonoi
Magician


Joined: 28 Jan 2007
Posts: 430

PostPosted: Sat Mar 10, 2007 2:23 pm   
 
Perhaps try gagging a line after the command you're triggering it for is completed? Info you've provided is small at best so I can't really say more unless you give some sort of exact example. Until then:

Code:

#trigger {blah does that} {execute command;#GAG}



Prog
_________________
The Proud new owner of CMud.

--------------------------------
Intel Core i5-650 3,2GHz
4 DD3 RAM
GTX 460 768MB
Win 7 Home Premium 64x
--------------------------------
Reply with quote
niav
Newbie


Joined: 18 Dec 2006
Posts: 4
Location: home

PostPosted: Sat Mar 10, 2007 2:29 pm   
 
It would go something like this,

Jack Runs up the hill
#WAIT 1000
follow jack

Jack Runs up the hill
#WAIT 1000
follow jack

So I would end up following him twice, when I only want to do it once. I'm waiting to perform an action, and if the same thing happens again, I want the first action to be ignored.
Reply with quote
Progonoi
Magician


Joined: 28 Jan 2007
Posts: 430

PostPosted: Sat Mar 10, 2007 2:49 pm   
 
Okay. Lets see.

First of all, #wait is evil, don't use that. In case you want to wait 1 second and then follow, use

Code:


#alarm "Follow" {*1} {follow jack;#t- Follow}



This alarm will fire after one second, then follow jack and then disable itself.

How thing could look like:

Code:


#trigger {Jack runs up the hill} {#t+ Follow}



this will trigger the alarm when seeing the line "Jack runs up the hill".

About the annoyance with extra line... unless you're seeing that line 2 times at the same exact time, perhaps forget about the wait period and follow soon as you see Jack. That way you won't be there when second line comes? Anyway, if the waiting period needs to be there etc, you might wanna read about trigger states and perhaps make a #condition to move right after the alarm has fired once...

Code:

http://www.zuggsoft.com/page.php?file=library/trigadv.htm#Trigger%20States



I'm not much familiar with different trigger states or multiline triggers myself, hence I can't help you out much in there :)


Prog
Reply with quote
niav
Newbie


Joined: 18 Dec 2006
Posts: 4
Location: home

PostPosted: Sat Mar 10, 2007 3:04 pm   
 
Well if it happens, I want it to ignore the first line completely and go with the second, that way the timer is on time.
Reply with quote
Progonoi
Magician


Joined: 28 Jan 2007
Posts: 430

PostPosted: Sat Mar 10, 2007 3:17 pm   
 
I guess this is one of those things that are hard to grasp without seeing how it works and looks like inside the mud exactly. If you don't mind, you might want to paste a block from your mud here, though.

All I can say right now is that either read through trigger states chapter and perhaps use some form of condition for removing the second or first line OR try this:


Code:

#class {Follow_Jack}
#trigger {Jack runs up the hill} {#t+ Follow;#t+ gag_jack}
#alarm "Follow" {*1} {follow Jack;#t- Follow;#t- gag_jack}
#class 0
#class {gag_jack}
#trigger {Jack runs up the hill} {#gag}
#class 0


This piece of code basically picks up the line with jack, enables the alarm to follow him in one second, then gags the line with Jack. Alarm is set to fire after 1 second that is it will follow jack in 1 second and then disable the alarm. Try this first before making everything more complicated with state triggers. Ideally gagging a line should work. I wrote a second class with only gagging trigger inside, once you have seen the line once, it should gag it and do all the actions I told you about, and after you have followed it and alarm has been disabled, the gagging class will be disabled again, until next time.

Try this. If it doesn't work, start to read about state triggers.


Prog
Reply with quote
vey2000
Novice


Joined: 21 May 2004
Posts: 32

PostPosted: Sat Mar 10, 2007 6:19 pm   
 
I think what he means is that the alarm should be reset to 1 second after the last time the trigger matched. So the following is enough:

Code:
#class {Follow_Jack}
#trigger {Jack runs  up the hill} {#t+ Follow}
#alarm "Follow" {*1} {follow jack;#t- Follow}
#class 0


I haven't used alarms much, but a bit of testing showed that #t+ Follow is enough to reset the alarm.

But as everyone has said, without knowing more about it that's the best we can do. If the second message is received more than a second after the first -- 1050 milliseconds, for example -- you'll still be sending it twice.
Reply with quote
Progonoi
Magician


Joined: 28 Jan 2007
Posts: 430

PostPosted: Sat Mar 10, 2007 6:34 pm   
 
Yes, thats enough when the line about Jack is only appearing once. As he said it isn't, thus I came up with gagging the line and putting the gagging trigger into a seperate class, thats all.

Prog
_________________
The Proud new owner of CMud.

--------------------------------
Intel Core i5-650 3,2GHz
4 DD3 RAM
GTX 460 768MB
Win 7 Home Premium 64x
--------------------------------
Reply with quote
vey2000
Novice


Joined: 21 May 2004
Posts: 32

PostPosted: Sat Mar 10, 2007 6:36 pm   
 
But he wants the first action to be ignored if there's a second one. So he's not interested in doing something right away on the first line, but only 1 second after the last time the line is seen.
Reply with quote
Danlo
Magician


Joined: 28 Nov 2003
Posts: 313
Location: Australia

PostPosted: Tue Mar 13, 2007 11:47 am   
 
Vey2000's trigger is enough to do what niag wants. The "*1" might be giving problems, though, since it's set to go off EVERY second, not just the first second after the trigger fires. Basically what Vey2000 has done, by giving the alarm an ID, every time the trigger fires it simple overwrites the existing alarm with a new alarm. You might try adding the class to the #alarm, though. Just to ensure that you don't accidentally create the same alarm in separate classes. Ie:

#alarm "Follow" {+1} {follow jack;#t- Follow} {}
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