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
darkspot
Apprentice


Joined: 29 Jul 2002
Posts: 105

PostPosted: Sat Mar 15, 2008 1:12 am   

Multi Line Capture
 
I tried searching, but couldn't find any of the old topics. I'm stumped, I avoided conditions forever, because it always broke on me. But I figured I'll give it another shot.

#trigger {you tell} {#capture tells}
#cond { %s*} {#capture tells} {looppar|param=50}


ALTERNATIVELY
#cond { %s*} {#capture tells} {looplines|param=50}



Either way, it wants to go through 50 lines before it says okay I can capture another tell. I can get tells of 1 to infinite lines (most I had was around 30). It's server side parsing (those bastards) and it can't be removed. Is there some way to tell it to stop? The end line is USUALLY > or blank, BUT sometimes it's anything, the major difference is the tells extra lines will usually be at least 5 or more spaces to start (Depends on the person's name sending) and the other lines at most usually have 3 or 4 (hence 5 spaces then %s on the cond). So roughly the end line is any line that DOESN'T start with 5 spaces. It might be just a blank line, a > or anything else for that matter. If this is posted somewhere else still point me to it, I did try searching and I must just be using the wrong keywords. I used to think there was some Achea Channel capture that did almost exactly this with different syntaxes but same idea, but I couldn't find it.
Reply with quote
Leitia
Adept


Joined: 04 May 2007
Posts: 292
Location: Boston

PostPosted: Sat Mar 15, 2008 2:26 am   
 
[editing out things here because I did not understand the question]

OK I think this is the solution, sorry the prompt is not reliable, in this link it says how to match everything but the lines with 5 spaces. I think I know that offhand but you will like this

http://www.regular-expressions.info/

no that's not right either, I give up
Reply with quote
Tech
GURU


Joined: 18 Oct 2000
Posts: 2733
Location: Atlanta, USA

PostPosted: Sat Mar 15, 2008 6:44 am   
 
Maybe something akin to this will do the trick. I tend to use two triggers for this, since you never really know the number of lines.

Code:
#trigger {you tell} {#capture tells;#T+ TellCapture}
#cond {^[^ ]{5}} {#T- TellCapture} {regex}
#TRIGGER TellCapture {     } {#capture tells}


That's mostly off the top of my head but should do the trick. The first one turns on TellCapture so that it keeps going until the end. It will stop at any line that doesn't start with 5 spaces.
_________________
Asati di tempari!
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4690
Location: Pensacola, FL, USA

PostPosted: Sat Mar 15, 2008 8:06 am   
 
need a space between pattern and value brackets on tellcapture
_________________
Discord: Shalimarwildcat
Reply with quote
Fang Xianfu
GURU


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

PostPosted: Sat Mar 15, 2008 5:24 pm   
 
I hope you don't mind, I went back and fixed that space and your pattern. You don't need to begin or end a trigger with * ever.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
darkspot
Apprentice


Joined: 29 Jul 2002
Posts: 105

PostPosted: Sat Mar 15, 2008 6:11 pm   
 
I like it. I was using ^{ | |} but it was breaking a little and that was the condition and ... yeah it was missing occasional lines (I think empty lines). I like that but I don't QUITe get how the {^{^ }*} works. I looked and ^ means don't match... so don't match 5 spaces, then don't match ANYTHING else... wouldn't you want 5 spaces? It seems to work so far so I won't argue, just trying to learn how and why things work so I can use them if I ever need/want to later.
Reply with quote
darkspot
Apprentice


Joined: 29 Jul 2002
Posts: 105

PostPosted: Sat Mar 15, 2008 6:34 pm   
 
Okay it makes some more sense. As ^ is the start line character. I have a single problem and I am not quite sure how to make it work. Sometimes as I said it's a blank line. It's rare, but it does happen.
ALSO
when I get two things with you tell to start it, that are both one line, it fails. Is there a way to arrange the priority or somesuch to make it able to fire on itself twice if the state pushes it back?
Reply with quote
darkspot
Apprentice


Joined: 29 Jul 2002
Posts: 105

PostPosted: Sat Mar 15, 2008 6:40 pm   
 
What about making the extra tellcapture trigger... fire on the other version... So something like..

Code:

#trigger {you tell} {#capture tells;#T+ TellCapture}
#cond {^[^ ]{5}} {T- TellCapture} {regex}
#TRIGGER TellCapture {^{     |you tell}} {#capture tells}


Thing is I got this feeling if there's then three in a row (also possible) it'd capture the next one twice.... but... at that point could put a trigger in the tell window to remove extra duplicate lines.. something like... #trigger {*} {#if (%line = %line2) {#gag}} seems... extra to have to do that to the tell window.
Reply with quote
Tech
GURU


Joined: 18 Oct 2000
Posts: 2733
Location: Atlanta, USA

PostPosted: Sat Mar 15, 2008 7:32 pm   
 
No worries. As I said, it was mostly at the top of my head.
_________________
Asati di tempari!
Reply with quote
darkspot
Apprentice


Joined: 29 Jul 2002
Posts: 105

PostPosted: Sat Mar 15, 2008 9:23 pm   
 
Here's how I ended up. And yes I know it's not what I said, but I had multiple versions, one for channels, and one for tells, all had the same problem but luckily only channels had the able to follow each other problem.
Code:

#trigger channelcapture {<{kingdom|clan|world}>} {#capture tells;#t+ tellcapture}
#cond {^[^     ]} {#t- TellCapture}
// Sorry I couldn't get the other version to work... but this one did.  Without the [^ ]{5}  and then no regex needed.
#trigger {you tell} {#capture tells;#t+ tellcapture}
#cond {^[^     ]} {#t- TellCapture}
#trigger {tells you} {#capture tells;#t+ tellcapture}
#cond {^[^     ]} {#t- TellCapture}
#trigger TellCapture {^     } {#capture tells}
#trigger {<{clan|kingdom|world}>} {#t- tellcapture;#state channelcapture 0}
// notice this has clan first.  This is abusing that in zmud I don't know any priority except classes, and in the same classes it goes alphabetically, SO make this one fire first.
Reply with quote
darkspot
Apprentice


Joined: 29 Jul 2002
Posts: 105

PostPosted: Fri Mar 21, 2008 12:35 am   
 
Code:

#trigger {<{clan|kingdom|religion}>l} {#capture tells;#T+ TellCapture}
#cond {^[^ ]{5}} {#T- TellCapture} {regex}
#TRIGGER TellCapture {     } {#capture tells}


Does anyone have any idea for a fix if you get two lines in a row? only some channels can, religion/clan. But it CAN fire twice in a row
For instance

Mike <clan> Hiya!
Mike <clan> How is everyone?

The script worked this time, I got frustrated cause something was buggy and I finally picked out why. The things can happen line after each other. any ideas?
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