Hi I am loving Mudlet a lot but will even more once I get more familiar with things I know. I come from a zMUD and cMUD background, but also have a bit of Lua experience.
The MUD I play on has a lot of parties. The party formation lines up in a sort of 3x3 grid. I mainly play a healer and am trying to set up a visual representation of this grid to make healing for parties easier. I have managed to set up a 3x3 grid of geyser gauges that is not perfect but a good starting point.
I can do something like:
lua h2bar:setValue(50, 100, "name")
From the command line and see that the gauge works, but I'm having trouble doing this from within the script of the trigger that I have set up to do so.
The trigger is designed to fire of of the following line.
| 1.2 name ldr 688( 688) 1221(1221) 294(303) | 90 | 34214 |
Trigger pattern is:
^\|[*\s](\d+\.\d+)\s+((?:\+|.)\w+)\s+(\w+)\s+(|-)(\d+)\(((?:\s|.)\d+)\)\s+(|-)(\d+)\(((?:\s|.)\d+)\)\s+(|-)(\d+)\(((?:\s|.)\d+)\)\s+\|\s+(\d+|\w+)\s+\|\s+(\d+)\s+\|$
Trigger script is:
name = matches[3]
hp = matches[6]
maxhp = matches[7]
pos = matches[2]
hpdif = maxhp-hp
echo("\ntrigger fired\n")
-- assign position in formation to one of the 9 formation bars
if toString(matches[2]) == "1.1" then
h1bar:setValue(toNumber(hp), toNumber(maxhp), toString(name))
echo("\nif 1 fired\n")
elseif
matches[2] == "1.2" then
h2bar:setValue(hp, maxhp, name)
echo("\nif 2 fired\n")
elseif
pos == "1.3" then
h3bar:setValue(hp, maxhp, name)
echo("\nif 3 fired\n")
elseif
pos == "2.1" then
h4bar:setValue(hp, maxhp, name)
elseif
pos == "2.2" then
h5bar:setValue(hp, maxhp, name)
elseif
pos == "2.3" then
h6bar:setValue(hp, maxhp, name)
elseif
pos == "3.1" then
h7bar:setValue(hp, maxhp, name)
elseif
pos == "3.2" then
h8bar:setValue(hp, maxhp, name)
elseif
pos == "3.3" then
h9bar:setValue(hp, maxhp, name)
end
Ok so I know the trigger works because the trigger fired echo is printed to the screen. I can also echo out the matches[] to see that they are capturing the correct information. Where I am stumped at right now is the if elseif statement test echos won't fire no matter what. I've tried all kinds of things and nothing seems to work. I can't get the gauges to be populated at all.
Is there a kind soul out there that might shed some light onto where I am going wrong?
Thanks,
Mike