Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: 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
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: 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).
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: 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
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: 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
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: 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}
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net