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


Joined: 26 Nov 2008
Posts: 1

PostPosted: Wed Nov 26, 2008 4:06 am   

Triggers: IF/Cond/Within an All-in-One Solution?
 
I've been scouring the zMUD helpfiles but I haven't exactly found what I'm looking for. Basically I want a trigger to fire only if a certain sentence appears after X amount of lines. I think in concept it should be doable, but I'm not sure.

My situation is something like this

AA
b
c
d
e
FF
g
h
i
j
KK

AA, FF, and KK are the sentences that i want the trigger to fire on; the small letters represents possible sentences inbetween the sentences in question.

AA will always happen. FF and KK may or may not happen, $they can happen together, but they will *always* happen after AA.

If neither FF or KK happens, I would like AA to run command1.
If only KK happens (after AA), i would like command2 to run *instead* of command1 (or run before command1 is run).
If only FF happens (after AA), i would like command3 to run *instead* of command1 (or run before command1 is run).

The last scenario if both FF and KK happen at the same time. In such a case, if it's possible, it would be easiest to run command4. If not, then I would like KK to have priority over FF if they both happen to appear together.

I've been playing with conditions in such fashion:
#trigger {AA} {command1}
#cond {KK} {command2}
but then both command1 and command2 are run causing conflicts.

To be honest, my problem could be solved if i knew how to have the trigger check if something is true or not after X lines.
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Wed Nov 26, 2008 6:58 am   
 
Use a multistate trigger with the first state firing before this text comes and the second firing after it. Have the trigger enable a class in the first state and disable a class in the second state. In the class are triggers that fire on whatever messages you're looking for. Those triggers will store whether or not they've fired successfully in variables (which are reset to false by the first state of the original trigger). The second state will then look at the variables and decide which command to run based on their values.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
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