Events and triggers

Post Reply
Jor'Mox
Posts: 1146
Joined: Wed Apr 03, 2013 2:19 am

Events and triggers

Post by Jor'Mox »

I am trying to collect certain information during combat via triggers that raise events which then do all the heavy lifting. But I'm running into a problem in that it seems that the event triggered from one line isn't finishing before the event triggered on the next line runs.

Specifically, the first line is something like this:
Bob's smash mauls George.
The second line is like this:
George is knocked to the ground by a heavy mace.

The first line holds all the necessary identifying information, and the second one doesn't, and the second line doesn't always happen. So in the code handling the first line, I set some variables to keep track of who is attacking whom. The code for the second line then uses that to keep track of who knocked whom to the ground. But sometimes when there are a lot of attacks in a single round, the secondary affect gets attributed to the wrong person.

As an aside, these are both raising the SAME event, but with different arguments so that they can be distinguished in code. Any ideas on how to get this to work?

User avatar
Vadi
Posts: 5042
Joined: Sat Mar 14, 2009 3:13 pm

Re: Events and triggers

Post by Vadi »

Bob's smash mauls George.
George is knocked to the ground by a heavy mace.george fell
always go off trigger hit. Did George fall? Yep.
(ex) 4900h|106%, 4730m|100%, 87w%, 100e%, (cdk)- {25 Glacian}

Bob's smash mauls George.
(ex) 4900h|106%, 4730m|100%, 87w%, 100e%, (cdk)- {25 Glacian}always go off trigger hit. Did George
fall? Nope.
Will this do? Attached is the trigger.
Attachments
trigger.xml
(3.55 KiB) Downloaded 235 times

Jor'Mox
Posts: 1146
Joined: Wed Apr 03, 2013 2:19 am

Re: Events and triggers

Post by Jor'Mox »

Maybe. Though I can't make the filtering trigger a multiline trigger because I have multiple lines of regex that I use to match all of the different ways that combat damage can be displayed. To give an example of what I'm trying to do, I'm trying to take this: (The ": VAMP" text is added in by a simple trigger I used just to ensure I was capturing the flags correctly.)

A gnome stone excavator's slash mauls [49] Leiedros.
A gnome stone excavator's slash misses Torgulin.
[40] Thzad's slice MANGLES a gnome stone excavator!
An old axe draws life from a gnome stone excavator. : VAMP
[40] Thzad's slice MANGLES a gnome stone excavator!
An old axe draws life from a gnome stone excavator. : VAMP
Your chop MANGLES a gnome stone excavator!
A fine alloy great axe draws life from a gnome stone excavator. : VAMP
A gnome stone excavator dodges your attack.
Your chop MASSACRES a gnome stone excavator!
A fine alloy great axe draws life from a gnome stone excavator. : VAMP
Your pierce MUTILATES a gnome stone excavator!
A fine alloy great dagger draws life from a gnome stone excavator. : VAMP
Your chop DISEMBOWELS a gnome stone excavator!
A fine alloy great axe draws life from a gnome stone excavator. : VAMP
Your pierce maims a gnome stone excavator!
A fine alloy great dagger draws life from a gnome stone excavator. : VAMP
[49] Leiedros's chop *** DEVASTATES *** a gnome stone excavator!
An arcanium spiked axe draws life from a gnome stone excavator. : VAMP
[49] Leiedros's pierce MANGLES a gnome stone excavator!
An adamantium skain draws life from a gnome stone excavator. : VAMP
[49] Leiedros's chop *** DEVASTATES *** a gnome stone excavator!
An arcanium spiked axe draws life from a gnome stone excavator. : VAMP
[49] Leiedros's pierce DISMEMBERS a gnome stone excavator!
An adamantium skain draws life from a gnome stone excavator. : VAMP
[49] Leiedros's chop *** DEVASTATES *** a gnome stone excavator!
An arcanium spiked axe draws life from a gnome stone excavator. : VAMP
[49] Leiedros's chop *** DEVASTATES *** a gnome stone excavator!
An arcanium spiked axe draws life from a gnome stone excavator. : VAMP
[49] Leiedros's chop misses a gnome stone excavator.
Torgulin's slash === OBLITERATES === a gnome stone excavator!
An asterite two handed sword draws life from a gnome stone excavator. : VAMP
Torgulin's bite === OBLITERATES === a gnome stone excavator!
A shark tooth draws life from a gnome stone excavator. : VAMP
Torgulin's slash === OBLITERATES === a gnome stone excavator!
An asterite two handed sword draws life from a gnome stone excavator. : VAMP
Torgulin's bite === OBLITERATES === a gnome stone excavator!
A shark tooth draws life from a gnome stone excavator. : VAMP
Torgulin's slash === OBLITERATES === a gnome stone excavator!
An asterite two handed sword draws life from a gnome stone excavator. : VAMP
Torgulin's slash === OBLITERATES === a gnome stone excavator!
An asterite two handed sword draws life from a gnome stone excavator. : VAMP
Torgulin's slash === OBLITERATES === a gnome stone excavator!
An asterite two handed sword draws life from a gnome stone excavator. : VAMP
Eikamii's shock *** DEMOLISHES *** a gnome stone excavator!
A gnome stone excavator is in awful condition.

(An Uneven, Hot Corridor)(Offensive)(Day Time)
(Protection Evil)(Haste)(Flying)(Bless)
(5:00pm)(1445/1424hp 243/271m 352/352mv)(E-NW)

And turn it into this:

A gnome stone excavator => Leiedros: 22 (1/2) [slash]
Thzad => A gnome stone excavator: 109 (2/2) [slice] V-2
You => A gnome stone excavator: 220 (5/6) [chop, pierce] V-5
Leiedros => A gnome stone excavator: 373 (6/7) [chop, pierce] V-6
Torgulin => A gnome stone excavator: 684 (8/8) [slash, bite] V-8

(An Uneven, Hot Corridor)(Offensive)(Day Time)
(Protection Evil)(Haste)(Flying)(Bless)
(5:00pm)(1445/1424hp 243/271m 352/352mv)(E-NW)

Because, honestly, that many lines of text flying by every few seconds is extremely hard to deal with. But, I'll try a filtering strategy in the morning and see how that goes. That said, since I already have it running off of events, if I raise two events consecutively inside a single trigger, can I be certain that the first will finish running before the second starts? Or not?

User avatar
Vadi
Posts: 5042
Joined: Sat Mar 14, 2009 3:13 pm

Re: Events and triggers

Post by Vadi »

On my mobile atm - yes, you can be.

Jor'Mox
Posts: 1146
Joined: Wed Apr 03, 2013 2:19 am

Re: Events and triggers

Post by Jor'Mox »

So, apparently the problem was in my display code. The secondary effects were all being attributed properly, I was just handling the display incorrectly. I was recording the information for each type of attack, with evasion being its own type. Only the secondary effect information from the last attack type for each person was being used, instead of being all combined together.

On the up side, it means that events raised from triggers that fire in sequence are also performed in sequence. Thanks for the help!

Post Reply