I found code in this thread:
http://mushclient.com/forum/bbshowpost.php?id=7669
titled "Matching a trigger multiple times on the same line" and I got it to work on my trigger text in that it shows me on each line what I'm looking for.
The code for the trigger and script is:
What I want to do it take the triggered name (t [1]) and set a variable by that name (int, wis, dex...) and add the # from (t [2]) to the variable.
So, when I look at myself and see the gear I'm wearing it will add up all the int or dex or dmg in each variable so I can then show a total.
For instance:
would allow me to print the totals with an alias.
"You are wearing int=9, con=4, svs=-8, dmg=9..."
http://mushclient.com/forum/bbshowpost.php?id=7669
titled "Matching a trigger multiple times on the same line" and I got it to work on my trigger text in that it shows me on each line what I'm looking for.
The code for the trigger and script is:
<triggers>
<trigger
enabled="y"
expand_variables="y"
keep_evaluating="y"
match="(int:|wis:|dex:|str:|chr:|con:|luc:|dmg:|hr:|da:|ma:|svs:)(\D*\d+)"
name="additup"
regexp="y"
repeat="y"
script="attrib_trigger_script"
send_to="12"
sequence="100"
>
</trigger>
</triggers>
function attrib_trigger_script (name, line, wildcards)
-- function to handle individual matches
local function one_attrib (m, t)
-- print ("count", t [1])
-- print ("attrib", t [2])
SetVariable (t [1], t [2])
end -- one_herb
local re = rex.new (GetTriggerInfo (name, 1)) -- get the match text, make into a regexp
re:gmatch (line, one_attrib) -- match repeatedly, call function
end -- attrib_trigger_script
What I want to do it take the triggered name (t [1]) and set a variable by that name (int, wis, dex...) and add the # from (t [2]) to the variable.
So, when I look at myself and see the gear I'm wearing it will add up all the int or dex or dmg in each variable so I can then show a total.
For instance:
<used as light> (Moderate magic) (Glowing) a war banner [gm|ac:-2 svs:-2 1#]
<worn on finger> (Moderate magic) the radiant zircon ring [m|AC 0 hr:3 2#]
<worn on body> (Weak magic) a dragon scale shirt [m|AC 12 ma:5 16#]
<worn on head> (Moderate magic) an Atheist's sensibilities [m|AC 6 int:3 int:3 1#]
<worn on legs> (Moderate magic) a pair of heavy cloth commoner's pants [mAN|AC 5 str:3 2#]
<worn on feet> (Moderate magic) a pair of heavy cloth slippers [m|AC 5 dmg:2 con:2 1#]
<worn on hands> (Potent magic) a pair of quilted cloth formal gloves [m|AC 6 wis:5 1#]
<worn on arms> (Moderate magic) a pair of leather sleeves [m|AC 4 wis:2 wis:2 2#]
<worn about body> (Moderate magic) the Crest of Cormac [!m|AC 6 dmg:2 svs:-3 5#]
<worn about waist> (Moderate magic) (Woven) a nine-stranded embroidered belt [m|AC 4 dmg:3 1#]
<worn around wrist> (Moderate magic) the grimy adamantite bracelet [m|AC 0 int:1 hr:2 0#]
<worn around wrist> (Moderate magic) a storm-blue mithril wristguard [m|AC 0 dmg:1 str:3 3#]
<wielded> (Powerful magic) a steel short sword [mAEAN|7-11 hr:5 dmg:4 5#]
<held> (Moderate magic) a black bone staff [!mAGAN|svs:-4 5#]
<worn with pride> (Weak magic) a Crest bearing the Midgaard Coat of Arms [m|svs:-1 3#]
<worn with pride> a cloth baldric, draped over the shoulder
would allow me to print the totals with an alias.
"You are wearing int=9, con=4, svs=-8, dmg=9..."