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


Joined: 04 Jul 2002
Posts: 6
Location: Germany

PostPosted: Thu Jan 30, 2003 5:36 am   

Need help on multiline-capturing
 
I would like to know how to capture an unknown amount of text-lines (first line and last line are known) and finally put it to one string-var..

for example: MUD-Outpout looks like this:

Line 1: Summary:
Line x: This is some kind of
Line x: summary where the total lines
Line x: are unknown.
Line n: End Summary.

and now i want the x-lines in one variable. Any idea what kind of trigger i have to define?
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: Thu Jan 30, 2003 6:19 am   
 
Concept:

Source
quote:

Resetting Triggers
What if you wanted to end the previous trigger before the 5 lines were up? For example, what if you wanted to collect the inventory until a blank line was received? Well, you can use the new #STATE command to set the current state of any trigger. Setting a trigger state back to zero resets the trigger. So, you could do the following:

#TRIGGER InvTrig {Inventory} {#VAR Inv "";#TEMP {^$} {#STATE InvTrig 0}}
#COND {} {#ADDITEM Inv %line} {LoopLines|Param=99}



So similarily:

#TRIGGER SummaryTrig {^Summary~:} {#VAR V_Summary "";#TEMP {^End Summary.} {#STATE SummaryTrig 0}}
#COND {} {#ADDITEM V_Summary %line} {LoopLines|Param=99}

Assumes all summaries smaller than 99 lines.

Ton Diening
Reply with quote
Kitana
Newbie


Joined: 04 Jul 2002
Posts: 6
Location: Germany

PostPosted: Thu Jan 30, 2003 6:38 am   
 
Thx alot.. that really does the trick
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