Match part of trigger color

Posted by Zeno on Thu 11 Feb 2010 03:03 AM — 8 posts, 34,481 views.

USA #0
I'm trying to remember how to match on (part) of a triggers color. There's a line like "The <noun> of the wand glows." where I need to match if the word color is red. My regex is more or less "The * of the wand glows".

I see getstyle, but I don't know how to have it match arg1 (%1) for this trigger.
Australia Forum Administrator #1
It is more or less covered here:

Template:post=7818
Please see the forum thread: http://gammon.com.au/forum/?id=7818.


In essence, getstyle gives you the colour if you know the column, and in your case you do (it's column 5).
USA #2
Yeah I read that post and it only provides examples of functions, unless I'm missing something. I guess I'm wondering what the first arg of getstyles would be then.
Australia Forum Administrator #3
The style runs as supplied to your trigger.
USA #4
Not sure I follow. You mean I need to change my trigger to match the color instead of looking for that in the Send?
Australia Forum Administrator #5
Can you post your trigger please?
USA #6
<triggers>
  <trigger
   enabled="y"
   group="wand"
   match="The \w+ of the wand glows"
   regexp="y"
   send_to="12"
   sequence="100"
  >
  <send>require "getstyle"

 style = GetStyle (styles, 10)

</send>
  </trigger>
</triggers>


From what I remember triggers had an implicit arg passed to it called styles, along with line, wildcards etc. Maybe not.

I then need to check the color of the arg to see if it's red.
Australia Forum Administrator #7
See:

http://www.gammon.com.au/scripts/doc.php?dialog=IDD_EDIT_TRIGGER

In particular:


If you use "send to script (after omit)" then the style runs are also available from the global variable: TriggerStyleRuns.


So, either use a script function, in which case the styles are the 4th argument, or change it to "send to script (after omit)" and then use:


style = GetStyle (TriggerStyleRuns, 10)


Then check style.textcolour.