Trigger styles

Posted by Shaun Biggs on Tue 17 Jul 2007 02:51 AM — 5 posts, 19,727 views.

USA #0
How do you access the style of the line that a trigger has matched within the send field? I know that there is a table as the fourth argument once you have passed it to a script, but I would like to have some control over what is displayed while just using the trigger editor.

Also, is there any way to make a regex to have match a string which is always six characters long, the first 1-5 of which are spaces, and the remainder is made of just numbers? Currently I just have it match "\s{1,5}\d{1,5}" but that will match one space and one number, or five spaces and five numbers, which it shouldn't.
USA #1
I've been poking through the forums again, and I came upon the part of the faq that shows the chat capturing into another window. I was trying out what was done in there, but TriggerStyleRuns is always nil when I match the trigger.
Australia Forum Administrator #2
I can't offhand think of a way of doing that without the brute-force method of checking all 6 cases:


((\s{5}\d)|(\s{4}\d{2})|(\s{3}\d{3})|(\s{2}\d{4})|(\s{1}\d{5})|(\d{6}))


Or, you could just check for "[\s\d]{6}" and then inside the trigger script make sure that the spaces are on the left.

As for TriggerStyleRuns, are you using "send to script (after omit)"? This sentence is in the help file for editing triggers:


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


Amended on Tue 17 Jul 2007 05:37 AM by Nick Gammon
USA #3
Ah, I didn't realize that the only way to get the TriggerStyleRuns to get something assigned to it was to omit it. I didn't bother with omissions originally, since I wanted to see what the original data was and compare it to what was being printed by my script.
Australia Forum Administrator #4
You don't have to omit it, you have to select "send to script (after omit)". The subtle difference is the order in which scripts are processed. In other words:


send_to="14"


There is no requirement to actually omit the matching line.