|
miconnor Newbie
Joined: 27 Aug 2008 Posts: 5
|
Posted: Wed Aug 27, 2008 3:38 am
Saving ansi info in variable |
I'm using a trigger that captures text and saves it to a variable. Is there any way for CMUD to save the ansi color of the text that is being captured?
|
|
|
|
miconnor Newbie
Joined: 27 Aug 2008 Posts: 5
|
Posted: Wed Aug 27, 2008 3:47 am |
Just for reference, here is the trigger I'm using.
Pattern:
Script:
Code: |
#IF %1=~"< %nh/%nH %nv/%nV Pos:*>"
{
#T- identify_DB_class_capture
#T- identify_DB_class
}
{
#var str_cap %1
#print Capture String = @str_cap
}
|
|
|
|
|
Merilix Beginner
Joined: 20 Aug 2008 Posts: 24 Location: Germany
|
Posted: Wed Aug 27, 2008 4:04 am |
You could try something like this
Code: |
<trigger priority="2120" ansi="true" trigontrig="false" id="212">
<pattern>%e[(%d)S(*)%e[0m</pattern>
<value>colorcode=%1
text=%2</value>
</trigger> |
|
|
|
|
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Wed Aug 27, 2008 5:29 pm |
To explain:
You don't use %1, %2, etc. within trigger patterns. Instead you put the part you want to capture within parentheses, (whatever). Within the script body, you then use %1 to refer to the part captured by the first parentheses, %2 for the second parentheses, etc. In the trigger pattern, the capture parentheses can go around any valid trigger pattern. (*) will capture anything. (%w %w) will capture two words. (Rahab's %w) will capture the text "Rahab's" followed by one word.
Are you trying to capture just the ansi code for the color? This is the pattern I would use: (%e[%dm)
That evaluates to 'ESC', '[', a number, and the letter m. Modify this to suit your needs. You could explain further what exactly you are trying to capture, and give us some examples, and we could suggest something. |
|
|
|
|
|