Multiline info thing

Posted by Metsuro on Mon 13 Sep 2004 04:45 PM — 2 posts, 12,060 views.

USA #0
Trying to get lines like

An almost complete robot's elbow nicks you! (1)
An almost complete robot's elbow nicks you! (6)
An almost complete robot's knee nicks you! (5)

to take the damage add them together and gag the attack and just send the damage at the end of it to lower spam. not quite sure how to even begin to start this
Australia Forum Administrator #1
First I would get the adding right. Something like this:


Match: A* nicks you! (*)
Send:

SetVariable "damage", CInt (GetVariable ("damage")) + %2

Send to: script
Omit from output: checked
Sequence: 90


That should add up the damage amounts into a variable called "damage",.

Now you need to detect when the list has ended.

Say, another trigger that matches everything, and shows the total, then clears it out:


Match: *
Send:

if CInt (GetVariable ("damage")) > 0 Then
  ColourNote "white", "red", "Total damage = " & GetVariable ("damage")
  SetVariable "damage", "0"
end if

Send to: script
Keep evaluating: checked
Sequence: 100


The first trigger with the lower sequence number will match the damage message, add it up, and omit the line.

The second trigger, which will only match if the first one doesn't, shows a non-zero total (since it then sets it to zero, you won't get the message repeatedly).

Then by using "keep evaluating" your other triggers will also match as usual.