|
charneus Wizard
Joined: 19 Jun 2005 Posts: 1876 Location: California
|
Posted: Fri Aug 31, 2007 9:47 pm
Quick question... |
Since I don't deal with trigger states all that often, I want to know if anyone can tell me how to do the following:
Currently, I have a trigger set up to sub my damage types. What used to look like:
Code: |
Your thrust LACERATES a young wyvern! [324]
Your thrust misses a young wyvern. [0]
Your thrust DECIMATES a young wyvern! [471]
|
now looks like:
Code: |
You hit a young wyvern for 324 points of damage!
You hit a young wyvern for 0 points of damage!
You hit a young wyvern for 471 points of damage! |
What I want to do is combine all three lines into one, so the output is:
Code: |
You hit a young wyvern for a total of 795 points of damage! |
The number of lines in a row can vary quite a bit, so I don't have a definitive number. Any help would be greatly appreciated. Thanks!
Charneus |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Fri Aug 31, 2007 10:40 pm |
Difficult because multistate triggers are only really meant to execute in a fixed order. If you always attack three times, you could do:
#trig {You hit * for (%d) points of damage!} {#gag}
#cond {You hit * for (%d) points of damage!} {#gag}
#cond {You hit (*) for (%d) points of damage!} {#sub {You hit %1 for a total of %eval(%t1+%t2+%t4) points of damage!}}
If you don't always hit three times, you'd be better off using a single trigger and having it repeat until something ends the block of attacks (like a prompt). |
|
|
|
charneus Wizard
Joined: 19 Jun 2005 Posts: 1876 Location: California
|
Posted: Fri Aug 31, 2007 10:44 pm |
Ugh. That sucks. It isn't always three. :\ I suppose I could make a separate trigger for each number of times I attack, though... :\
Charneus |
|
|
|
Vijilante SubAdmin
Joined: 18 Nov 2001 Posts: 5182
|
Posted: Fri Aug 31, 2007 10:49 pm |
This is quite the messy situation to do, but can be reduced to a neat handler. Neatness simply requires a line not like those damage lines to be recieved. I routinely use a conditional substate with looplines(no pattern desired), both newline and prompt options, and then a script based parse of %line to determine what I caught. Dredge around in the search for examples of how I do multiline captures and handling and you should see multiple examples of this. It has been my finding that it is the most consistent method of handling such things across all needs.
|
|
_________________ The only good questions are the ones we have never answered before.
Search the Forums |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Sat Sep 01, 2007 12:13 am |
charneus wrote: |
I suppose I could make a separate trigger for each number of times I attack |
That wouldn't work - if you had one trigger for two attacks, one for three, and one for four, then all three would fire if four or more attacks were sent.
If you use a single trigger that adds together attacks like:
#trig {You hit * for (%d) points of damage!} {#add damage %1;#gag}
Then you just need a line that always ends the block of attacks (sometimes a blank line follows a block of attacks, sometimes it's a prompt). Then you can do:
#trig {line that ends the block} {#say You hit @target for @damage damage this round.;damage=0} |
|
|
|
|
|