 |
wildwinds Newbie
Joined: 05 Jan 2005 Posts: 1
|
Posted: Wed Jan 05, 2005 5:48 pm
ANSI triggers |
I seem to be having problems getting an ANSI trigger to work at all.
I have tried doing what it says in the help file, creating a trigger and in trigger options selecting ANSI trigger, and then highlighting a string on the mud and pasting it into the trigger pattern box, the string appears in the pattern box with ANSI colour codes, but when I save it and the string appears again the trigger doesnt fire, the colours are all identical to the original, if I copy the string into the trigger test box it says that the pattern matches.
any help with this would be greatly appreciated. |
|
|
|
 |
nexela Wizard

Joined: 15 Jan 2002 Posts: 1644 Location: USA
|
Posted: Thu Jan 06, 2005 5:55 am |
From some of the testing I have seen Muds that don't send a color code (i.e default text) an ansi trigger won't match it, Also if your Anchoring it to the end of a line and the mud changes color codes before it won't match.
|
|
|
|
 |
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Thu Jan 06, 2005 9:29 pm |
Another possibility is that the MUD is using MXP codes to control your text colors rather than ANSI codes. If this is the case, I think you'll probably have to limit yourself to normal triggers.
|
|
_________________ LightBulb
Senior member
Most scripts in this forum are written for Command Line entry.
Don't even open the Settings Editor unless its use is specified or obvious. |
|
|
 |
Pega Magician
Joined: 08 Jan 2001 Posts: 341 Location: Singapore
|
Posted: Fri Jan 07, 2005 1:56 am |
I noticed something about how zMUD parses ANSI triggers.
With emulate control codes unchecked, this is the string that is shown in the output window:
| Quote: |
<27>[1;37m*<27>[31m*<27>[32mA Mob sits here.
|
An ANSI trigger that detects the line above is:
| Quote: |
| \033[1;37m\*\033[1;31m\*\033[1;32m(.+) |
This string however would not match:
| Quote: |
| \033[1;37m\*\033[31m\*\033[32m(.+) |
Through this observation I can say that the form of data which the (ANSI) triggers parse, is at least similar to what is displayed in the Mud Output Window instead of what first comes in from the mud.
This is probably also the reason why the non-color related ANSI escape codes are not detectable by zMUD's ANSI triggers, because what is parsed by your script comes from a buffer which only contains displayable ASCII and text colour information.
As mentioned elsewhere, zMUD utilizes a line parser. Each block of data is first filtered of its control codes to create a preliminary representation of a line, subsequently the triggers in your script will then get the chance to work on this line. This is fast, but we have to adapt with its features.
Correct me if you think I am mistaken. |
|
|
|
 |
Pega Magician
Joined: 08 Jan 2001 Posts: 341 Location: Singapore
|
Posted: Fri Jan 07, 2005 8:55 am Re: ANSI triggers |
| wildwinds wrote: |
I seem to be having problems getting an ANSI trigger to work at all.
I have tried doing what it says in the help file, creating a trigger and in trigger options selecting ANSI trigger, and then highlighting a string on the mud and pasting it into the trigger pattern box, the string appears in the pattern box with ANSI colour codes, but when I save it and the string appears again the trigger doesnt fire, the colours are all identical to the original, if I copy the string into the trigger test box it says that the pattern matches.
any help with this would be greatly appreciated. |
I guess I digressed a bit with my previous message.
The following are a few reasons why an ANSI trigger may not be working.
1. What Nexela said, the end of line matching '$' causes problems with ANSI triggers.
By the way, I notice that ANSI triggers can match lines from the mud with no ANSI codes in it, as long as the ANSI colour codes in the ANSI trigger match the colours displayed in the output.
2. ANSI trigger on prompts may have some complications.
The trigger may have some trouble determining the beginning and end of the actual text as opposed to the beginning and end of the text containing ANSI escape codes, I think this can be seen when substituting text using ANSI triggers without anchoring it to the beginning of the line.
3. Verbatim mode is not compatible with ANSI triggers unless you find a way to place the actual escape character directly into your script. ANSI triggers generally cannot be verbatim because the script needs to convert %e, \033 or %char(27), etc. into an escape character in order to match the same character in zMUD's mud output contents.
From my experience ANSI triggers are not able to work in the trigger test box.
Hope that helps. |
|
|
|
 |
Pega Magician
Joined: 08 Jan 2001 Posts: 341 Location: Singapore
|
Posted: Sat Jan 08, 2005 12:43 am |
Here are a couple other things to watch for when using ANSI triggers.
Let's say we are triggering on this string:
| Quote: |
| PrefixTargetString |
Assuming Prefix is white and TargetString is yellow.
An ANSI trigger with this pattern would trigger on it:
| Code: |
| \033\[1;37mPrefix\033\[1;33mTargetString |
So far so good.
A problem arises when the Prefix is the same colour as the TargetString. In which case, you need an ANSI trigger pattern similar to these to recognise it:
| Code: |
\033\[1;33mPrefixTargetString
\033\[1;3(?:3|7)mPrefix(?:\033\[1;33m)?TargetString
(?:\033\[1;37mPrefix\033\[1;33m|\033\[1;33mPrefix)TargetString |
Note that the ANSI codes do not always immediately precede TargetString.
Also note that in zMUD, the ANSI code esc[1m is taken to mean Bold instead of Highlight. Highlighted colours here are in the 50-58 range as opposed to the 30-38 range for normal colours. The 50-58 range is rarely used on muds and I don't know if it is widely recognised by other clients, this however gives zMUD the ability to differentiate a bold effect vs a highlight effect from ANSI codes.
In zMUD, if you use %ansi(white) and %ansi(yellow) or %ansi(high,gray) and %ansi(high,brown), what you get is esc[57m and esc[53m respectively. Whereas if you use %ansi(bold,gray) and %ansi(bold,brown), you will then get esc[1;37m and esc[1;33m respectively.
This means that if you want to test your ANSI triggers for patterns originating from the mud using a #show command, it would usually be something like this:
| Quote: |
| #show {%ansi(bold,gray)Prefix%ansi(bold,brown)TargetString} |
In my earlier message, the backslashes preceding a [ character disappeared when they were not marked as code. |
|
|
|
 |
|
|
|
|
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
|
|