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
➜ Reading the color of triggering text?
Reading the color of triggering text?
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| j0nas
(56 posts) Bio
|
Date
| Sat 16 Feb 2002 03:56 AM (UTC) |
Message
| Is it possible to read the color of some triggering text? I play a mud with friendly and hostile mobs, the friendly ones have green names while the hostile ones have red names. I would like my script to be able to tell them apart, and adding each mob by hand isn't an option.
Is it possible? | Top |
|
Posted by
| Nick Gammon
Australia (23,140 posts) Bio
Forum Administrator |
Date
| Reply #1 on Sat 16 Feb 2002 05:37 AM (UTC) |
Message
| You can make a trigger match on a colour, thus you could make two triggers, one that matches on red and one on green. Doing that, you could tell them apart in a script. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| j0nas
(56 posts) Bio
|
Date
| Reply #2 on Sun 17 Feb 2002 12:34 AM (UTC) |
Message
| The problem is that the string looks like this for enemies:
<green>Ancient Sir <red>Killsalot <green>is here.
and for friends:
<green>Ancient Sir Healsalot is here.
I can only seem to find trigger-functions that match the color of the first char in the string, and since both of my strings begin with the same color and only differ in the middle, I can't figure out any way to make it work. | Top |
|
Posted by
| Nick Gammon
Australia (23,140 posts) Bio
Forum Administrator |
Date
| Reply #3 on Sun 17 Feb 2002 09:00 PM (UTC) |
Message
| It depends in this case. Triggers don't have to match a whole line, regular expression triggers in particular can match a word only.
Something like this might work for you:
\w+ is here.$
In this case the \w represents a "word" character (letters, digits, underscores etc.) so it would match on the final word of your example, eg. "Healsalot is here".
Then the colour test should work. This mightn't work as well if the mob name can contains spaces, but in that case you would have a similar problem in a script. Where do you start looking for the "red" part?
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| j0nas
(56 posts) Bio
|
Date
| Reply #4 on Sun 17 Feb 2002 09:10 PM (UTC) |
Message
| Oh, that works perfectly. Thanks! | 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,504 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top