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


Joined: 20 Feb 2008
Posts: 2
Location: North Carolina

PostPosted: Wed Feb 20, 2008 10:48 pm   

ANSI Triggers
 
Okay, so I'm trying to make a trigger that replaces colored text with text and a number. For example.

Your slash wounds a wombat.

to

Your slash wounds (19-23) a wombat.

Now that's very easy to do with #SUB, and I get the desired results.

However, if anything else says "wounds" then I get the (19-23) beside it, and that's just not going to work.

I am trying to use ANSI Trigger and followed the instructions for it, copying and pasting the red wounds message into the pattern box, but it never works.
It looks like this:

Code:
%e[1;31mwounds%e[0m


and when I look under Test Pattern I see

Code:
1;31mwounds


So... what am I doing wrong? Thanks for reading Very Happy
Reply with quote
Arminas
Wizard


Joined: 11 Jul 2002
Posts: 1265
Location: USA

PostPosted: Wed Feb 20, 2008 11:12 pm   
 
Try putting a ~ before the ['s in your pattern.

Code:
%e~[1;31mwounds%e~[0m
_________________
Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram
Reply with quote
TimNC
Newbie


Joined: 20 Feb 2008
Posts: 2
Location: North Carolina

PostPosted: Thu Feb 21, 2008 1:29 am   
 
Well it makes the test pattern happy but it doesn't actually trigger in game. Very strange.
Reply with quote
oldguy2
Wizard


Joined: 17 Jun 2006
Posts: 1201

PostPosted: Thu Feb 21, 2008 1:53 am   
 
I'm curious why you are using an ansi trigger if you don't want it to trigger on any other "wounds" anyway and are just subbing that specific trigger pattern? The numbers you are including are damage done? Can't you just sub your attack message and then include the number in the sub?
Reply with quote
Arminas
Wizard


Joined: 11 Jul 2002
Posts: 1265
Location: USA

PostPosted: Thu Feb 21, 2008 2:07 am   
 
Hrm... Try putting another ~ before the ;
_________________
Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram
Reply with quote
luggage
Novice


Joined: 20 Jul 2004
Posts: 38
Location: Australia

PostPosted: Thu Feb 21, 2008 8:33 am   
 
Um, no. You shouldn't be using ~ inside the escape codes.

I have a colour trigger that works under cmud to grab comm lines.
It is:

#TRIGGER {%e[35m(%x)} {#CAP comms;#GAG}

which grabs lines of a specific colour that is only used by comm lines.

and yeah, under the test pattern, I see '35m' as well. still works fine.
And .. no, I cannot cut and paste to test the trigger either, because the colouring doesn't carry across.
Maybe something that needs fixing in a future version.

You probably don't need the '%e[0m' as that is just a code to change the colour back to normal.
Try checking to see what gets actually sent from the mud ...
You can do this by turning on the Script Debugger, or logging with ansi codes on to a file.
If all combat messages are similar to the example, it might be easier writing something like:

#TRIGGER {^Your {slash|slice|dice|cut} wounds} {do trigger stuff}

Finally, a few ppl (me included) have problems with ansi triggers in that sometimes the escape sequence comes in as a '%e[OS' instead of the proper escape sequence. Hopefully fixed in the next version.
Reply with quote
Fang Xianfu
GURU


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

PostPosted: Thu Feb 21, 2008 11:23 am   
 
luggage wrote:
Try checking to see what gets actually sent from the mud ... You can do this by turning on the Script Debugger, or logging with ansi codes on to a file.

Be careful when doing this. The data that's coming from the server isn't necessarily the data that CMUD uses to test ANSI triggers. If you use #debugfile or the debugger to view the ANSI codes, you'll notice that they're different to the codes that're shown in an ANSI log, or when you paste a line with ANSI codes into the pattern box of an ANSI trigger. This is because, for the purpose of ANSI triggers, CMUD ignores escape codes that don't actually do anything. This is to prevent your MUD from sending nonsense codes (a colour code that keeps the same colour, for example) in an attempt to stop the triggers from firing.

So you should either copy and paste your coloured line into the pattern box of an ANSI trigger, or use an ANSI log. Anything else may not be what CMUD uses to match its triggers.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
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