Is it possible to read the color of some triggering text? I play a mud with friendly and hostile mobs, the friendly ones have green names while the hostile ones have red names. I would like my script to be able to tell them apart, and adding each mob by hand isn't an option.
Is it possible?
You can make a trigger match on a colour, thus you could make two triggers, one that matches on red and one on green. Doing that, you could tell them apart in a script.
The problem is that the string looks like this for enemies:
<green>Ancient Sir <red>Killsalot <green>is here.
and for friends:
<green>Ancient Sir Healsalot is here.
I can only seem to find trigger-functions that match the color of the first char in the string, and since both of my strings begin with the same color and only differ in the middle, I can't figure out any way to make it work.
It depends in this case. Triggers don't have to match a whole line, regular expression triggers in particular can match a word only.
Something like this might work for you:
\w+ is here.$
In this case the \w represents a "word" character (letters, digits, underscores etc.) so it would match on the final word of your example, eg. "Healsalot is here".
Then the colour test should work. This mightn't work as well if the mob name can contains spaces, but in that case you would have a similar problem in a script. Where do you start looking for the "red" part?
Oh, that works perfectly. Thanks!