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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
wojciech_warmuz
Beginner


Joined: 27 Mar 2007
Posts: 20

PostPosted: Fri Jan 16, 2009 9:22 am   

Triggering multilines[Answered]
 
OK how can I trigger multilines?
like this
Code:
Alas!  Some of the sand is strangely washed down inside the
hole you are digging.  Perhaps this is a sign that there is actually
something further ahead, and all this hard work is not in vain.  As
you begin to wonder what dangers could lie in the darkness, a cold


I want to trigger all text incoming from mud... how should I set trigger?


Last edited by wojciech_warmuz on Sat Jan 17, 2009 11:06 am; edited 1 time in total
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Fri Jan 16, 2009 3:15 pm   
 
Is there any way to turn off internal line wrapping in your mud? If so, turn it off, and let cmud do the line wrapping for you. That way, cmud will see all that as a single line, and you don't have to worry about triggering on multiple lines.

If there is no way to make the mud send it as a single line, then you probably need a multistate trigger.

As an aside, do you actually want this to be an ansi trigger? That is, do you need the trigger to know about the ansi color codes imbedded in it?
Reply with quote
wojciech_warmuz
Beginner


Joined: 27 Mar 2007
Posts: 20

PostPosted: Fri Jan 16, 2009 3:39 pm   
 
ok, i think there is no way the mud senting a single line
I dont want to be ansi triggers, i did copy log with ansi codes becaouse i thought it will be helpfull, and i dont knwo really how to start think about it, so i thought maybe catch ansi end of line? dunno
no, i dont need to know about color codes but i think it should know about end of line...
Asked just to find out if there is any easy solution for triggering mutlilines...
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Fri Jan 16, 2009 5:14 pm   
 
The ansi codes at the end don't say that it's the end of the line, it just means "go back to default color". So we don't actually need the ansi stuff here.

The following commands would create a multistate trigger matching the lines you provide above.
Code:

#trigger {Alas!  Some of the sand is strangely washed down inside the} {}
#cond {hole you are digging.  Perhaps this is a sign that there is actually} {}
#cond {something further ahead, and all this hard work is not in vain.  As} {}
#cond {you begin to wonder what dangers could lie in the darkness, a cold} {<put code here that you want to execute after all the lines are detected>}

In explanation, a multistate trigger is a trigger that has multiple states. The trigger is in one state at a time, starting with the initial state (state 0). The active state waits for the conditions to fire, and after executing any code associated with that state it activates the next state. When the last state fires and finishes its code, it resets the state to 0. You can modify the behavior of each state, for instance by requiring that it detect a match and fire within a certain amount of time or number of lines, or that the state wait a certain amount of time before trying to fire. What I have done above is a simple multistate trigger with 4 states, and only the last state actually tries to run any code. Will something like this do what you want?
Reply with quote
wojciech_warmuz
Beginner


Joined: 27 Mar 2007
Posts: 20

PostPosted: Fri Jan 16, 2009 6:14 pm   
 
Yes, thank you for all explanation, i think it will work, never used #cond, so i will try it
thanks again
Reply with quote
oldguy2
Wizard


Joined: 17 Jun 2006
Posts: 1201

PostPosted: Fri Jan 16, 2009 10:34 pm   
 
You can run a script on any state. It doesn't have to be in the last state. For example, create a trigger with 4 states and put to print fired 1 through 4 in each individual one and it will print 1 through 4.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD 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