Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Due to spam on this forum, all posts now need moderator approval.
Entire forum
➜ MUSHclient
➜ General
➜ Omit from output, sometimes not omitting?
|
Omit from output, sometimes not omitting?
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
| Posted by
| Redryn
(15 posts) Bio
|
| Date
| Tue 10 May 2011 06:33 AM (UTC) Amended on Tue 10 May 2011 08:11 AM (UTC) by Nick Gammon
|
| Message
| Hiya,
I'm trying to write a plugin that will compact multi line damage output into a single line, ie:
Your hammering blow <->*<=> WASTES <=>*<-> Barney the Loser! [214]
Your hammering blow <->*<=> WASTES <=>*<-> Barney the Loser! [214]
Your hammering blow <->*<=> WASTES <=>*<-> Barney the Loser! [214]
Your hammering blow <->*<=> WASTES <=>*<-> Barney the Loser! [214]
Your hammering blow <->*<=> WASTES <=>*<-> Barney the Loser! [214]
Your hammering blow <->*<=> WASTES <=>*<-> Barney the Loser! [214]
Your hammering blow <->*<=> WASTES <=>*<-> Barney the Loser! [214]
---> [7] Your hammering blow does UNIMAGINABLE things to Barney the Loser! [1753] [250]
To do this, I have 2 triggers, one to detect when it's a line of damage output, and one to detect when it's not a line of damage output. I'm using omit_from_output for both, and also need to do so for the latter, because I want the compressed line to appear above the triggering non-damageoutput line.
<trigger
enabled="y"
match="^(.+) (hammering blow|frenzied attack|whipping|faith|heavenly balance) (?:lotsofverbshere) (.+) \[(\d+)\]$"
regexp="y"
name="CombatRoundtrig"
script="CombatRound"
keep_evaluating="y"
omit_from_output="y"
sequence="100"
> </trigger>
<trigger
enabled="n"
match="^((?!.+ (?:hammering blow|frenzied attack|whipping|faith|heavenly balance) (?:lotsofverbsheretoo) (?:.+) \[(?:\d+)\]).)*$"
regexp="y"
name="NotCombatRound"
script="CombatRoundEnd"
omit_from_output="y"
keep_evaluating="y"
sequence="100"
> </trigger>
function CombatRound (name,line,wildcards)
EnableTrigger("NotCombatRound",true)
Rounds = Rounds+1
User = wildcards[1]
Skilltype=wildcards[2]
Target = wildcards[3]
DamageDone = DamageDone+wildcards[4]
end
function CombatRoundEnd(name,line,wildcards,styles)
if User=="Your" then
linecolour="lime"
elseif Target=="you!" or Target=="you." then
linecolour="red"
else
linecolour="silver"
end
ColourTell(linecolour,"black","["..Rounds.."] "..User.." "..Skilltype.." ")
OutputDamverb(DamageDone)
ColourTell(linecolour,"black"," "..Target.." ","red","black","["..DamageDone.."] ["..string.format( "%.0f",DamageDone/Rounds).."]")
Note("")
for _, v in ipairs (styles) do
ColourTell (RGBColourToName (v.textcolour),RGBColourToName (v.backcolour),v.text)
end
Note ("")
EnableTrigger("NotCombatRound",false)
Rounds = 0
Target = ""
User = ""
Skilltype = ""
DamageDone = 0
end
The problem is however, that sometimes the 2nd trigger does not seem to omit the output properly.
Something like:
You daze Barney the Loser with a series of hammering blows!
Your hammering blow <*><*><*><*> ANNIHILATES <*><*><*><*> Barney the Loser! [248]
Your hammering blow <*><*><*><*> ANNIHILATES <*><*><*><*> Barney the Loser! [247]
Your hammering blow <*><*><*><*> ANNIHILATES <*><*><*><*> Barney the Loser! [247]
Your hammering blow <*><*><*><*> ANNIHILATES <*><*><*><*> Barney the Loser! [247]
Your hammering blow <*><*><*><*> ANNIHILATES <*><*><*><*> Barney the Loser! [247]
Your hammering blow <*><*><*><*> ANNIHILATES <*><*><*><*> Barney the Loser! [248]
Your hammering blow <*><*><*><*> ANNIHILATES <*><*><*><*> Barney the Loser! [248]
[10] Your pierce does UNBELIEVABLE things to Barney the Loser! [20770]
becomes
You daze Barney the Loser with a series of hammering blows!
[8] Your pierce does UNBELIEVABLE things to Barney the Loser! [16626]
[7] Your hammering blow does UNIMAGINABLE things to Barney the Loser! [1753] [250]
[8] Your pierce does UNBELIEVABLE things to Barney the Loser! [16626]
as opposed to (as the line above should be omitted)
[7] Your hammering blow does UNIMAGINABLE things to Barney the Loser! [1753] [250]
[8] Your pierce does UNBELIEVABLE things to Barney the Loser! [16626]
The strange thing is that this does not always happen. When I tried to fix it before by messing with triggers etc, sometimes it magically starts to omit properly, and continues to do so despite changing it back to the original code that did not work.
Thanks for any help :) | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #1 on Tue 10 May 2011 08:19 AM (UTC) |
| Message
| I'm not sure about the negative assertion there. I think I would make the "not damage" be a simple "*" (match everything) trigger that has a lower priority than the match damage. That also saves repeating everything.
So once you get the first damage line, you enable the other trigger as well. But don't have "keep evaluating" on the first one. So the first one catches the line, and the second one doesn't fire.
Once you get a non-damage line, the first trigger doesn't fire, it falls through to the second one. That doesn't have to omit from output, it just sends the summarized damage, and then disables itself. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Redryn
(15 posts) Bio
|
| Date
| Reply #2 on Tue 10 May 2011 08:49 AM (UTC) |
| Message
| Thanks, that works :)
But just to clarify on the omitting part, any idea what might cause it not to omit the line? I'm pretty sure that the trigger is firing at least, and on the right line since the styles table is correct; just not sure what might cause the line not to be omitted? | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #3 on Tue 10 May 2011 10:12 AM (UTC) |
| Message
| If my suggestion worked, I would say that the trigger didn't fire for some reason or another.
If you can reproduce it, with output pasted here, I can explore further. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Redryn
(15 posts) Bio
|
| Date
| Reply #4 on Tue 10 May 2011 12:02 PM (UTC) |
| Message
| The output when the bug occurs looks like this:
You daze Barney the Loser with a series of hammering blows!
[8] Your pierce does UNBELIEVABLE things to Barney the Loser! [16626] -- The original line
[7] Your hammering blow does UNIMAGINABLE things to Barney the Loser! [1753] [250] -- the compressed line generated by trig
[8] Your pierce does UNBELIEVABLE things to Barney the Loser! [16626] -- the recreated line from the styles table
When it is working properly it looks like this:
You daze Barney the Loser with a series of hammering blows!
[7] Your hammering blow does UNIMAGINABLE things to Barney the Loser! [1902] [272]
[9] Your pierce does UNBELIEVABLE things to Barney the Loser! [18625]
The line
[7] Your hammering blow does UNIMAGINABLE things to Barney the Loser! [1753] [250]
is only printed when the trigger fires, so the trigger is definitely firing.
I've tried debugging it before by capturing whatever it triggered on as a wildcard, and printing the wildcard.. ie
^(blahblah)$, as expected, wildcard[1] was
[9] Your pierce does UNBELIEVABLE things to Barney the Loser! [18625]
The strange thing is that it doesn't always fail to omit. It always works on completely blank lines. Using the test trigger function, i found it to omit properly if the [9] at the start of the line was removed, ie if it started with Your pierce ...
Even a [] Your pierce... would result in it not being omitted, (but the trigger still fired, and printed the other 2 lines).
And inexplicably, the originally trigger that I was using seems to work again, so I really have no idea why it breaks occasionally.. Is there anything that would stop the omission of a line? (ie incomplete packets, other plugins triggering on the same line, not matching the full line)?
It's not really a big issue as it's just aesthetics though :P
Thanks again! | | 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.
17,067 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top