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
➜ Lua
➜ Question about custom_colour
Question about custom_colour
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Blixel
(80 posts) Bio
|
Date
| Tue 20 Sep 2011 02:48 PM (UTC) |
Message
| I have a trigger set up to give me a visual cue when I take damage. It's real basic. It works like this:
<triggers>
<trigger
group="Status Check"
match="^\>?You have (.*?)\/(.*?) hitpoints.*?$"
name="HealthCheck"
regexp="y"
send_to="12"
sequence="100"
>
<send>EnableTrigger("HealthCheck", false)
if (%1 < (%2 * .20)) then
EnableTrigger("FlaskEmergency", true)
Send ("drink flask")
elseif (%1 < (%2 * .35)) then
ColourNote ("black", "red", "Health is %1")
elseif (%1 < (%2 * .45)) then
ColourNote ("black", "orange", "Health is %1")
end</send>
</trigger>
</triggers>
I noticed MUSHclient can replace the color of text. So I was wondering if instead of using these ColourNotes - which add more text to the screen - if I could instead use custom_colour to do the same thing?
When I tried to replace ColourNote with custom_colour in this trigger, I got compile errors. Is it the case that you can only use the custom_colour that is defined in the trigger header? Can you not set the custom_colour inside of the trigger? Something like this:
<triggers>
<trigger
enabled="y"
group="Tests"
keep_evaluating="y"
match="^\>?You have (.*?)\/(.*?) hitpoints.*?$"
name="colour_test"
regexp="y"
send_to="12"
sequence="100"
>
<send>if (%1 < (%2 * .85)) then
custom_colour="7"
elseif (%1 < (%2 * .90)) then
custom_colour="11"
elseif (%1 < (%2 * .95)) then
custom_colour="3"
end</send>
</trigger>
</triggers>
| Top |
|
Posted by
| Ada
(20 posts) Bio
|
Date
| Reply #1 on Tue 20 Sep 2011 04:37 PM (UTC) |
Message
| Select 'Omit from output' in the trigger to remove the original trigger text, after that use ColourNote("black", "red", "%0") etc. to rewrite the same line but now with colour. %0 holds the entire match text by the way. | Top |
|
Posted by
| Blixel
(80 posts) Bio
|
Date
| Reply #2 on Tue 20 Sep 2011 04:59 PM (UTC) |
Message
|
Ada said: Select 'Omit from output' in the trigger to remove the original trigger text, after that use ColourNote("black", "red", "%0") etc. to rewrite the same line but now with colour. %0 holds the entire match text by the way.
Hmm... that sounds good, but it doesn't seem to have the desired effect. The output color is ordinary white/gray text on black.
Screenshot: http://i.imgur.com/MDxLn.png
Is my trigger missing anything?
<triggers>
<trigger
enabled="y"
group="Status Check"
keep_evaluating="y"
match="^\>?You have (.*?)\/(.*?) hitpoints.*?$"
name="HealthCheck"
omit_from_output="y"
send_to="12"
sequence="100"
>
<send>EnableTrigger("HealthCheck", false)
if (%1 < (%2 * .25)) then
EnableTrigger("FlaskEmergency", true)
Send ("drink flask")
ColourNote("black", "red", "%0")
elseif (%1 < (%2 * .35)) then
--ColourNote ("black", "orange", "Health is %1")
ColourNote("black", "orange", "%0")
elseif (%1 < (%2 * .45)) then
--ColourNote ("black", "orange", "Health is %1")
ColourNote("black", "yellow", "%0")
elseif (%1 < (%2 * .7)) then
ColourNote ("black", "green", "%0")
else
ColourNote ("black", "blue", "%0")
end</send>
</trigger>
</triggers>
| Top |
|
Posted by
| Ada
(20 posts) Bio
|
Date
| Reply #3 on Tue 20 Sep 2011 05:35 PM (UTC) |
Message
| You forgot to select 'Regular expression' checkbox. | Top |
|
Posted by
| Blixel
(80 posts) Bio
|
Date
| Reply #4 on Tue 20 Sep 2011 05:46 PM (UTC) |
Message
|
Ada said: You forgot to select 'Regular expression' checkbox.
... and now it works. (I'm a moron.)
Thanks. This is going to be very useful. | 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.
15,706 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top