Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.
 Entire forum ➜ MUSHclient ➜ Lua ➜ Trigger styles

Trigger styles

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Shaun Biggs   USA  (644 posts)  Bio
Date Tue 17 Jul 2007 02:51 AM (UTC)
Message
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.

It is much easier to fight for one's ideals than to live up to them.
Top

Posted by Shaun Biggs   USA  (644 posts)  Bio
Date Reply #1 on Tue 17 Jul 2007 03:41 AM (UTC)
Message
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.

It is much easier to fight for one's ideals than to live up to them.
Top

Posted by Nick Gammon   Australia  (23,120 posts)  Bio   Forum Administrator
Date Reply #2 on Tue 17 Jul 2007 05:36 AM (UTC)

Amended on Tue 17 Jul 2007 05:37 AM (UTC) by Nick Gammon

Message
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.



- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Shaun Biggs   USA  (644 posts)  Bio
Date Reply #3 on Tue 17 Jul 2007 05:48 AM (UTC)
Message
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.

It is much easier to fight for one's ideals than to live up to them.
Top

Posted by Nick Gammon   Australia  (23,120 posts)  Bio   Forum Administrator
Date Reply #4 on Tue 17 Jul 2007 06:04 AM (UTC)
Message
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.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


14,468 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.