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.
Due to spam on this forum, all posts now need moderator approval.
Entire forum
➜ MUSHclient
➜ General
➜ Trouble with Set/GetTriggerOption
Trouble with Set/GetTriggerOption
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Larkin
(278 posts) Bio
|
Date
| Thu 11 Jun 2009 07:01 PM (UTC) |
Message
| 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:
<triggers>
<trigger
back_colour="8"
enabled="y"
keep_evaluating="y"
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)\.\))?$"
match_back_colour="y"
match_bold="y"
match_text_colour="y"
name="mapper_title__"
omit_from_output="y"
regexp="y"
script="mapper_title"
sequence="10000"
text_colour="11"
>
</trigger>
</triggers>
When I do something like SetTriggerOption("mapper_title__", "text_colour", 9), it doesn't change to red. Help, please? | Top |
|
Posted by
| Fadedparadox
USA (91 posts) Bio
|
Date
| Reply #1 on Thu 11 Jun 2009 08:48 PM (UTC) |
Message
| 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. | Top |
|
Posted by
| Larkin
(278 posts) Bio
|
Date
| Reply #2 on Thu 11 Jun 2009 08:53 PM (UTC) |
Message
| 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! | Top |
|
Posted by
| Fadedparadox
USA (91 posts) 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
|
Message
| 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. | Top |
|
Posted by
| Larkin
(278 posts) Bio
|
Date
| Reply #4 on Thu 11 Jun 2009 09:15 PM (UTC) |
Message
| 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)
| Top |
|
Posted by
| WillFa
USA (525 posts) Bio
|
Date
| Reply #5 on Thu 11 Jun 2009 09:43 PM (UTC) |
Message
| |
Posted by
| Nick Gammon
Australia (23,133 posts) 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
|
Message
| 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 | Top |
|
Posted by
| Larkin
(278 posts) Bio
|
Date
| Reply #7 on Fri 12 Jun 2009 12:51 AM (UTC) |
Message
| Aha!
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. | 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.
26,229 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top