[Home] [Downloads] [Search] [Help/forum]

Gammon Forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Lua
. . -> [Subject]  Highlighting values in a table with addxml.
Home  |  Users  |  Search  |  FAQ
Register forum user name
Forgotten password?

Highlighting values in a table with addxml.

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page

Posted by ReallyCurious   USA  (50 posts)  [Biography] bio
Date Mon 21 May 2007 06:23 PM (UTC)
I have different tables for different things and sometimes I want those values to be colored, sometimes I don't.


clanA = {"Warrior", "Cleric", "Paladin", "Warlock", "Magician"} -- This table would be in my script file and would have over 200 names in some cases.

match="Updateit *"
<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>

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.)
[Go to top] top

Posted by Nick Gammon   Australia  (21,607 posts)  [Biography] bio   Forum Administrator
Date Reply #1 on Mon 21 May 2007 09:04 PM (UTC)

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
[Go to top] top

Posted by ReallyCurious   USA  (50 posts)  [Biography] 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

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.
[Go to top] 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.


It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page

Go to topic:           Search the forum

[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at FutureQuest]