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


Joined: 01 Dec 2006
Posts: 178

PostPosted: Mon Aug 11, 2008 9:13 am   

Ansi trigger problems
 
is it just me or are ansi triggers quirky.
isn't it possible to create a trigger that only in part of the line searches for a color

blahblahblah |blop| blahblahblah


wouldn't matter what color the blahblahs was however | would be one color and blop another color followed by the same | color again
I've been trying to get it to work and it just won't work.

Also inserting a . seems to mess up the ansi trigger totally? like if I do

%e[1;31m*

that will fire on any bright red line..
%ansi(12) to be specific.
But
%e[1;31m*.
won't even if the red line ends with a .
and doing ~. doesn't help either.
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Mon Aug 11, 2008 4:38 pm   
 
Quote:
%e[1;31m*

that will fire on any bright red line..
%ansi(12) to be specific.
But
%e[1;31m*.
won't even if the red line ends with a .

It works for me. Are you sure you have it coded right?

For your other question, the easiest way to get an ansi trigger is:
Get the mud to send you the line you want to match
In the Package Editor, create a new trigger
Click the box marked 'ANSI trigger'
Cut the line from the mud and paste into the trigger line
Edit the trigger as needed
Reply with quote
XonDK
Apprentice


Joined: 01 Dec 2006
Posts: 178

PostPosted: Tue Aug 12, 2008 1:51 pm   
 
I copy/paste a line several different colors and the exact text, and it won't trigger

how does the trigger you wrote look like for multiple colors in the line.
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Tue Aug 12, 2008 4:31 pm   
 
Here's an example. On the command line, I do:
Code:
#show %ansi(red)This %ansi(yellow)is %ansi(blue,bold)a %ansi(green,yellow)test.

I cut and paste the resulting line into an ANSI trigger pattern, and it looks like this:
Code:
%e[31mThis %e[53mis %e[1;34ma %e[0;32;47mtest.%e[0m$

I put a test message into the trigger body, and send the #show again. The trigger fires properly. I edit the trigger pattern down to this and it still triggers properly:
Code:
%e[53mis*.
Reply with quote
XonDK
Apprentice


Joined: 01 Dec 2006
Posts: 178

PostPosted: Fri Aug 15, 2008 8:02 am   
 
what I've been trying to do is this.

a trigger that
checks for one color
%e[33m*%e[0m*%e[1;31m (%e[0m$

that's a brown text and a red (
and between that text there may be something that has another color and this trigger alone won't fire.
from my understanding. %e[0m is used to tell cmud not to check for color?
Add I also want to capture what is after the ( but adding a (*) doesn't work
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Fri Aug 15, 2008 1:59 pm   
 
Quote:
from my understanding. %e[0m is used to tell cmud not to check for color?

I believe that is actually the ansi code for 'default' color. To not check for color, you could use * or some more elaborate matching pattern.

Quote:
%e[33m*%e[0m*%e[1;31m (%e[0m$

The problem is completely unrelated to the ansi codes. Parentheses are special characters in triggers. In order to match an actual parethesis, you need to put a ~ in front of it, e.g. ~(

Quote:
Add I also want to capture what is after the ( but adding a (*) doesn't work

If I understand what you mean, what you need is this (I'm assuming there is a closing parenthesis as well, and you are trying to capture whatever is within the parentheses):
Code:
%e[33m*%e[1;31m ~((*)~)

If this is not what you want, please copy one or two examples of the actual text you are trying to match, complete with the ansi codes.
Reply with quote
XonDK
Apprentice


Joined: 01 Dec 2006
Posts: 178

PostPosted: Sun Aug 17, 2008 12:50 pm   
 
ahhhhh didn't know * would allow me to use whatever, knew about the special code, just a typo here, the trigger is working now thanks!
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