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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD Beta Forum
Loftaris
Adept


Joined: 24 Aug 2004
Posts: 277

PostPosted: Mon Aug 09, 2010 7:09 pm   

Chatline capture trigger assistance please
 
Windows 7
Cmud Beta 3.22a

I'm trying to alter a trigger someone gave to me, but for the of me I can't get it working. I checked help files, and searched the forums, but that's not working either. Can someone give me some assistance please?

The line I'm looking to capture, looks like this:

[Missions:Player] this is a line of text

For reference, this is the code I'm trying to use, and I need it to capture multiple lines if there are any... :

Code:
<trigger priority="9611" regex="true" id="1248">
  <pattern>\[Missions:(%w)\] .*</pattern>
  <value>:Tells:#SAYPROMPT {%cr%ansi(bold,yellow)""%ansi(blue)"["Mission"] "%ansi(bold,grey)%1}</value>
  <trigger type="Loop Pattern" regex="true" prompt="true">
    <pattern>^ +(.*)$$</pattern>
    <value>:Tells:#SAYPROMPT {%ansi(bold,grey)" "%1}</value>
  </trigger>
</trigger>


When there's something said on the line, I'll get:

[Mission] Player

If they type so it wraps to the next line, I'll get:

[Mission] Player second line of text

If anyone has a suggestion as to why it's not working, or a better setup, I'd be appreciative![/code]
Reply with quote
Loftaris
Adept


Joined: 24 Aug 2004
Posts: 277

PostPosted: Tue Aug 10, 2010 2:21 pm   
 
shameless bump

Does no one have any suggestions on how I can fix this?

Pretty please?
Reply with quote
Derar
Novice


Joined: 09 Sep 2006
Posts: 44

PostPosted: Tue Aug 10, 2010 2:36 pm   
 
%w is not a regex reference, so your problem would appear to be that you're mixing pattern recognition "languages".

Try \w+ instead of %w.

Also, are you recolouring the text from the original, or replicating the original colour? If you're replicating, it seems like a lot of extra code work when '#CAPTURE 1 Tells' would work.

Finally, while I can't hold that this is true in all cases, I would expect any single block of channel text to be treated as one line upon receipt, so a single line trigger should capture the whole thing; any word wrapping typically occurs client-side. So unless the mud is actually enforcing line length limits with its own newline characters, the loop state is probably unnecessary.

Edit: I just reread the pattern and realised the second trigger is not for a new line but for the actual message text... I would expect you can probably eliminate it and fold it into the first pattern still, by replace '.*' with '(.*)$$' and working with %2 in the script, or if the colours are replication as I mentioned above, #CAPTURE will cart the whole line over, without having to worry about references.
Reply with quote
Loftaris
Adept


Joined: 24 Aug 2004
Posts: 277

PostPosted: Tue Aug 10, 2010 2:41 pm   
 
The \w+ fixed one problem, but it's still not capturing the first line of test. I still get [Mission] Player (blank line)

Yes, I'm recoloring the test because I've got about 12 different lines captured, and it makes it difficult when several of the lines have the same color mud-side.

I do believe the mud is adding it's own newline characters, because it won't capture the 2nd line otherwise if I don't have the loop line.
Reply with quote
Loftaris
Adept


Joined: 24 Aug 2004
Posts: 277

PostPosted: Tue Aug 10, 2010 2:43 pm   
 
Oh, nevermind I see what I did there. When I recreated the trigger I forgot to add (.*) to capture text... It seems to be working now.
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Tue Aug 10, 2010 8:36 pm   
 
If the mud is sending newlines, you could check whether there is a setting on the mud to turn linewrapping. Many muds have such a setting.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD Beta Forum 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