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.)
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.)