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
➜ Match part of trigger color
|
Match part of trigger color
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
| Posted by
| Zeno
USA (2,871 posts) Bio
|
| Date
| Thu 11 Feb 2010 03:03 AM (UTC) |
| Message
| 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. |
Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #1 on Thu 11 Feb 2010 03:10 AM (UTC) |
| Message
| It is more or less covered here:
In essence, getstyle gives you the colour if you know the column, and in your case you do (it's column 5).
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Zeno
USA (2,871 posts) Bio
|
| Date
| Reply #2 on Thu 11 Feb 2010 03:15 AM (UTC) |
| Message
| | 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. |
Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #3 on Thu 11 Feb 2010 03:21 AM (UTC) |
| Message
| | The style runs as supplied to your trigger. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Zeno
USA (2,871 posts) Bio
|
| Date
| Reply #4 on Fri 12 Feb 2010 03:47 AM (UTC) |
| Message
| | Not sure I follow. You mean I need to change my trigger to match the color instead of looking for that in the Send? |
Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #5 on Fri 12 Feb 2010 04:05 AM (UTC) |
| Message
| | Can you post your trigger please? |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Zeno
USA (2,871 posts) Bio
|
| Date
| Reply #6 on Fri 12 Feb 2010 04:24 AM (UTC) |
| Message
| <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. |
Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #7 on Fri 12 Feb 2010 04:29 AM (UTC) |
| Message
| 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. |
- 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.
32,770 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top