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
➜ Replacing a trigger line
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Shadoweave
(42 posts) Bio
|
Date
| Tue 12 Feb 2008 05:42 PM (UTC) Amended on Tue 12 Feb 2008 05:45 PM (UTC) by Shadoweave
|
Message
| I have been trying to make a trigger so that it colours the name of my current target in red, and the rest in white. The trigger:
<trigger
enabled="y"
group="test"
match="^(.*)?([A-Z][a-z]+)(.*)?\.$"
omit_from_output="y"
regexp="y"
script="gagging"
send_to="14"
sequence="100"
>
</trigger>
Basically, the name of my target can either be the first wildcard from the pattern, or the second. What I am having troubles with is leaving the line as it is if the name of my target isn't in that sentence. Here is the gagging script:
function gagging (sName, sLine, wildcards, tStyle)
if (wildcards [1] == GetVariable ("target")) then
ColourTell ("red", "", wildcards [1])
ColourNote ("white", "", wildcards [2]..".")
elseif (wildcards [2] == GetVariable ("target")) then
ColourTell ("white", "", wildcards [1])
ColourTell ("red", "", wildcards [2])
if (wildcards [3]) then
ColourTell ("white", "", wildcards [3])
end --if
ColourNote ("white", "", ".")
else
for key, value in pairs (tStyle) do
if (key ~= #tStyle) then
ColourTell (value [textcolour], value [backcolour], value [text])
else
ColourNote (value.textcolour, value.backcolour, value.text)
end --if
end --for
end --if
end --function
The problems I encounter are here:
ColourTell (value [textcolour], value [backcolour], value [text])
I don't know how to transform the number from the textcolour field into a viable colour name for the ColourTell function. How do I do that? If anyone has a better idea about how to do this, I am more than willing to listen to any suggestions. | Top |
|
Posted by
| Ian Kirker
(30 posts) Bio
|
Date
| Reply #1 on Tue 12 Feb 2008 07:02 PM (UTC) |
Message
| Do you actually want the rest in white, or do you want it to be left alone? Because matching specific names and just colouring those is better (faster, so much faster) than matching every line as you're doing at the moment and recolouring it as it was supposed to be.
Anyway, if you're just trying to match one thing that's contained in a Variable, you can expand a variable in the match field as this person is doing:
http://www.gammon.com.au/forum/?id=8479&page=999
I think you can, anyway. | Top |
|
Posted by
| Shadoweave
(42 posts) Bio
|
Date
| Reply #2 on Tue 12 Feb 2008 08:08 PM (UTC) |
Message
|
Quote:
Do you actually want the rest in white, or do you want it to be left alone? Because matching specific names and just colouring those is better (faster, so much faster) than matching every line as you're doing at the moment and recolouring it as it was supposed to be.
Anyway, if you're just trying to match one thing that's contained in a Variable, you can expand a variable in the match field as this person is doing:
http://www.gammon.com.au/forum/?id=8479&page=999
I think you can, anyway.
No, I want the name of my current enemy in red, and the rest of the line, no matter if it comes before or after it, in white. The combat spam can overwhelm you in group fights, and I want to be able to see what my enemy is doing. | Top |
|
Posted by
| Ian Kirker
(30 posts) Bio
|
Date
| Reply #3 on Tue 12 Feb 2008 08:55 PM (UTC) |
Message
| Right, well, nevertheless, the above still holds - if you replace your match attribute with
It should expand to match only your target, and not every line containing any sequence of alphanumeric characters, meaning you shouldn't have to handle lines that don't contain the name. | Top |
|
Posted by
| Shadoweave
(42 posts) Bio
|
Date
| Reply #4 on Tue 12 Feb 2008 09:37 PM (UTC) Amended on Tue 12 Feb 2008 09:44 PM (UTC) by Shadoweave
|
Message
| It works now, thank you very much! | 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.
18,281 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top