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
➜ Highlighting values in a table with addxml.
|
Highlighting values in a table with addxml.
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
| Posted by
| ReallyCurious
USA (50 posts) Bio
|
| Date
| Mon 21 May 2007 06:23 PM (UTC) |
| Message
| I have different tables for different things and sometimes I want those values to be colored, sometimes I don't.
Example:
clanA = {"Warrior", "Cleric", "Paladin", "Warlock", "Magician"} -- This table would be in my script file and would have over 200 names in some cases.
<aliases>
<alias
match="Updateit *"
enabled="y"
expand_variables="y"
send_to="12"
sequence="100"
>
<send>for i,v in ipairs(clanA) do
if IsTrigger("v") ~= 0 then -- checks to see if trigger exists already.
require "addxml"
addxml.trigger { match = v,
regexp = true,
['repeat'] = true, -- repeat is lua kw
send = "",
sequence = 100,
name = v,
enabled = true,
custom_colour = %1, -- adds color I specified
keep_evaluating = true,
group = "clanA Highlights",
}
end -- if
end -- for
ColourNote("white", "red", "clanA highlights updated")</send>
</alias>
</aliases>
So, now I can change colors of any clan I want as long as I got their names inside a table. And EnableTriggerGroup can toggle them on/off if I want to.
Originally, I had a question about how to prevent this alias from creating multiple triggers with the same label(it was doing that), if I hit the alias twice for example. But it looks like doing a check with IsTrigger works it out.
The downside, though, is like my previous mud client I'm going to have many many triggers for highlights(if that's really a problem - i don't know.)
| | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #1 on Mon 21 May 2007 09:04 PM (UTC) |
| Message
|
Quote:
if IsTrigger("v") ~= 0 then
This line is wrong. It checks to see if (literally) "v" is a trigger.
You mean:
if IsTrigger(v) ~= 0 then
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| ReallyCurious
USA (50 posts) Bio
|
| Date
| Reply #2 on Mon 21 May 2007 10:44 PM (UTC) Amended on Mon 21 May 2007 10:50 PM (UTC) by ReallyCurious
|
| Message
| yea... I just deleted the IsTrigger part from the alias and tested it again, it's not giving 2 labels with the same name now. But, really though, something I did was creating 2 triggers with the same label. :/ Now everyone's gonna think I'm crazy if I don't duplicate what I was talking about.
Also, It's better to delete the IsTrigger part since there are no duplicate triggers so then I can change the trigger colours as I want. | | 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.
25,870 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top