 |
chris123zugg Adept
Joined: 23 Aug 2013 Posts: 227
|
Posted: Wed Jul 15, 2026 11:26 am
capturing ansi letters/words in sentences |
i need to be able to capture a series of ansi colored letters in a block of text and then use those letters, any idea how to go about this?
|
|
|
|
 |
shalimar GURU

Joined: 04 Aug 2002 Posts: 4805 Location: Pensacola, FL, USA
|
Posted: Wed Jul 15, 2026 2:34 pm |
If it is one of those bot checks where it changes... not so much.
While there is a way to trigger on color, it needs a static pattern.
The necessity of wildcards is what always threw off my attempts to solve the problem.
You could probably do it with use of the various string editing functions on the raw %line with ansi codes still intact.
Essentially, you have to parse it yourself.
Unless you have a different usecase. What are you trying to do? |
|
|
|
 |
chris123zugg Adept
Joined: 23 Aug 2013 Posts: 227
|
Posted: Thu Jul 23, 2026 4:19 pm |
its 3 generalized phrases but has a random letter(s) added to the prhase, and the prhase(s) also change depending on which monster you're fighting. so ive been wracking my brain trying to JUST capture works with ansi in it based on a set hook trigger.
|
|
|
|
 |
shalimar GURU

Joined: 04 Aug 2002 Posts: 4805 Location: Pensacola, FL, USA
|
Posted: Fri Jul 24, 2026 1:53 pm |
So long as there is a preface line, that would be your hook to turn on the custom parser.
| Code: |
#TR {some preface line} {
parsedLines=0
phrase=""
#T+ parser
}
#TR "parser" {*} {
//here is where we do parser tricks on %line
//like a %match on the specific ansi color code string
//with the goal of extracting the letters asked for and %concat ing them to @phrase
parsedLines=(@parsedLines+1)
#IF (@parsedLines>=3) {#T- parser;#SEND @phrase}
} |
Sounds like you only expect three lines, so we only need to test three lines and then stop |
|
|
|
 |
chris123zugg Adept
Joined: 23 Aug 2013 Posts: 227
|
Posted: Fri Jul 31, 2026 3:44 pm |
This is the entire sequence, i tried to capture the ansi but its impossible to see.
The sentences DO change but always start the same way so those can be used as the phase(s) hook.
any help with this would be great!
invoke prime power
You call forth a word of great power, invoking the prime nature of your
magic. Crumbling away from the corpse, the soul of the creature is
released in the form of a giant death's head that flies freely into the
room, leaving behind it a great trail of power waves!
invoke prime kiid
You speak: kiid!
You strain as you reel in the power of the prime spell!
Snarling at Valkyrie, the skull gnashes its teeth in anger.
invoke prime tia
You speak: tia!
With great effort, you hold the powerful spell in control.
With a horrid grin of death, the ghostly skull leers at Valkyrie.
invoke prime doo
You speak: doo!
With a will of iron, you finally guide the deadly spell toward its target.
With blinding speed and ferocious hatred, the ghostly death's head screams
as it sinks its pulsating fangs deeply into Valkyrie!
The ghostly apparition then dissipates away. |
|
|
|
 |
shalimar GURU

Joined: 04 Aug 2002 Posts: 4805 Location: Pensacola, FL, USA
|
Posted: Sat Aug 01, 2026 1:16 pm |
| Code: |
<trigger priority="1" ansi="true" regex="true" id="57134">
<pattern>\x1B\[1;30m([\w\s]+)\x1B</pattern>
<value>#PRInt {-%1}</value>
</trigger> |
I had to go regex for this as %e was not reliably catching the escape character
currently this only captures dark gray (ansi 8) phrases, you will have to change out the ansi color code (1;30) for whatever ansi color codes your game is using.
You can see the ansi codes in the debugger window. |
|
|
|
 |
|
|
|