[Home] [Downloads] [Search] [Help/forum]

Gammon Forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  General
. . -> [Subject]  Trouble with Set/GetTriggerOption
Home  |  Users  |  Search  |  FAQ
Register forum user name
Forgotten password?

Trouble with Set/GetTriggerOption

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

Posted by Larkin   (278 posts)  [Biography] bio
Date Thu 11 Jun 2009 07:01 PM (UTC)
I'm trying to change the color a trigger matches on, but SetTriggerOption is having no effect. When I tried to use GetTriggerOption to see the current value, I got a nil return, and so now I have no idea what I'm doing wrong...

Here's the trigger, for reference, of course:
   match="^(?:In the trees above |Flying above |On the rooftops over |In a pit at |In the mountains above |In a nest above )?(.+?)(?: \((?:road|path)\.\))?$"

When I do something like SetTriggerOption("mapper_title__", "text_colour", 9), it doesn't change to red. Help, please?
[Go to top] top

Posted by Fadedparadox   USA  (91 posts)  [Biography] bio
Date Reply #1 on Thu 11 Jun 2009 08:48 PM (UTC)
Hmm. I played with it and I keep getting an error saying the trigger option doesn't exist. I get it for back_colour, text_colour, name, match_text_colour, and match_back_colour. All of the others I tested it worked with. It didn't matter what trigger I was using, either.
[Go to top] top

Posted by Larkin   (278 posts)  [Biography] bio
Date Reply #2 on Thu 11 Jun 2009 08:53 PM (UTC)
Yeah, I think the documentation is wrong on this one. Seems like these options just didn't get implemented in MUSHclient or something. I looked at the TriggerOptionsTable in methods.cpp, and it doesn't have these listed!
[Go to top] top

Posted by Fadedparadox   USA  (91 posts)  [Biography] bio
Date Reply #3 on Thu 11 Jun 2009 09:05 PM (UTC)

Amended on Thu 11 Jun 2009 09:08 PM (UTC) by Fadedparadox

I ran through the source for MUSHclient and found the table of trigger options. None of those are on it, but 'match_style' is, and after testing it, it works. I'm not sure how to come up with a specific style, but I use GetTriggerOption and got a style of 6320 on your trigger. I changed the trigger style to 0 and it went back to default, changed it back to 6320 and it went back to what it was originally.
[Go to top] top

Posted by Larkin   (278 posts)  [Biography] bio
Date Reply #4 on Thu 11 Jun 2009 09:15 PM (UTC)
Actually, that does help. It'll be a little trickier, but now I can manipulate the attributes. For example, to get the current text color, I would do this:
text_color = bit.band(bit.shr(GetTriggerOption("mapper_title__", "match_style"), 4), 15)
[Go to top] top

Posted by WillFa   USA  (525 posts)  [Biography] bio
Date Reply #5 on Thu 11 Jun 2009 09:43 PM (UTC)
Nick goes through Match_style in this thread:


[Go to top] top

Posted by Nick Gammon   Australia  (21,607 posts)  [Biography] bio   Forum Administrator
Date Reply #6 on Fri 12 Jun 2009 12:37 AM (UTC)

Amended on Fri 12 Jun 2009 12:44 AM (UTC) by Nick Gammon

The documentation is indeed incorrect. I have amended it for the next version.

What happened here was I copied and pasted from the section for ImportXML (which is correct, and which is why you saw stuff like "match_back_colour" in the trigger you pasted). However the part of the program that implements GetTriggerOption handles the bits in the match_style field differently, and hence the explanation of their function that Willfa found at http://www.gammon.com.au/forum/?id=4873.

You may find it easier to use ImportXML rather than SetTriggerOption. The documentation for that has recently been amended to make clear that doing ImportXML on an existing trigger/alias/timer replaces it.

See http://www.gammon.com.au/forum/?id=7123 for the ways the various options work with ImportXML.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Larkin   (278 posts)  [Biography] bio
Date Reply #7 on Fri 12 Jun 2009 12:51 AM (UTC)

The post that WillFa referred me to actually did help, and I was able to set the style very easily once I understood the flags more clearly.

I use ImportXml in other places, and I thought about it for this, but I think the SetTriggerOption solution is simpler in this case.

Thanks again.
[Go to top] 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.


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

Go to topic:           Search the forum

[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

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


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at FutureQuest]