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
SethRizzen
Beginner


Joined: 07 Apr 2003
Posts: 15
Location: USA

PostPosted: Fri Jul 23, 2004 6:53 pm   

Combining attacks. SOLVED! Come check it out!!!
 
Hey all,

I've been mulling over this idea for awhile and I can't seem to find a good way to combine multiple attacks into one line. I've tried gagging everything and just spitting out a total damage and list of mobs that are hit. It seems to get very choppy when I do this though.

Here's what the output looks like:
Code:

Mota's lightning strikes your foes!
Your lightning bolt grazes a muscular rogue. (4164)
Your lightning bolt grazes a muscular rogue. (4164)
Your lightning bolt grazes a muscular rogue. (4164)
Your lightning bolt injures A male rogue. (6246)
Your lightning bolt injures A male rogue. (6246)
A muscular rogue has a few scratches.


I was thinking of something along these lines:

Code:

#Trigger {^Your lightning bolt %1 %2. ~(%n)} {
  #additem Enemy %2
  #add damage %3
  #gag
  } Attack
#Trigger {^%1 has a few scratches.} {
  #T- Attack
  #show {Your lightning bolt damages @Enemy. ~(@damage~)}
  }


The problem with this is that it will show the damage AFTER the condition of the mob. Also, when I cast 'call lighting', it isn't always immediately followed by the condition of the mob (IE: multiple casts per round). What I'm really looking for is under this logic:

if (nextline does not contain "Your lightning bolt") {
add up total
spit out one line with enemies
}

I guess this might fall under multi-line triggers, but there is no way for me to predict the number of lines that will be lightining (IE: Moving from one room to another with different number of mobs). Any help would be appreciated.

Thanx for your time.


Last edited by SethRizzen on Sat Jul 24, 2004 3:13 am; edited 1 time in total
Reply with quote
stick
Newbie


Joined: 11 Nov 2003
Posts: 7
Location: USA

PostPosted: Fri Jul 23, 2004 7:23 pm   
 
#action {^Your lightning bolt %w (*). ~((%d)~)} {#additem Enemy %1;#add damage %2;#gag;#T+ "{^Your lightning bolt} *"} Attack
#action {{^Your lightning bolt} *} {#show {Your lightning bolt damages @Enemy. ~(@damage)}

I think that might work for the problem of the condition not always following the casting of call lightning. You could always just gag the next line you recieve, show the lightning bolt string, and then show the line that you just gagged again.

Not sure if what I just did would work though... Getting a little rusty.
Reply with quote
SethRizzen
Beginner


Joined: 07 Apr 2003
Posts: 15
Location: USA

PostPosted: Fri Jul 23, 2004 8:09 pm   
 
EDITED BY AUTHOR!

Well, I finally figured it out. Took me long enough...

Here is a sample output from the MUD:
Code:
Mota's lightning strikes your foes!
Your lightning bolt DISMEMBERS a muscular rogue! (4228)
Your lightning bolt hits a muscular rogue. (4228)
Your lightning bolt hits a muscular rogue. (4228)
Your lightning bolt decimates A male rogue. (6342)
Your lightning bolt decimates A male rogue. (6342)
Your lightning bolt decimates A male rogue. (6342)
Your lightning bolt wounds A female bandit. (4228)
Your lightning bolt decimates A male rogue. (6342)
Your lightning bolt decimates A male rogue. (6342)
Your lightning bolt wounds A female bandit. (4228)
Your lightning bolt decimates A male rogue. (6342)
Your lightning bolt decimates A male rogue. (6342)
Your lightning bolt injures A female bandit. (4228)
A muscular rogue is in awful condition.


Here is the combined result:
Code:
Mota's lightning strikes your foes!
Your lightning bolt damages: muscular rogue, male rogue, female bandit! (69762)
A muscular rogue is in awful condition.


Big improvement on the eyes. What I have for the triggers are below, please note there are 3 triggers that I made, but only showed one for brevity. The difference between the triggers is the seperating word between @enemy and @tempcond (is,has,looks).
Code:
#TRIGGER {^&{enemy} is &{tempcond}} {
  ;Note the location of #T- Attack, if it isn't
  ;here, it creates an infinite loop.
    #T- Attack
  ;@condition is a pre-setup variable of the
  ;condition strings from the MUD. You will need
  ;to record your mud's strings to make this
  ;work.
    #if (%ismemeber( @tempcond, @conditions)) {
    #gag
    #show {Your lightning bolt damages: %expandlist( @enemies, ", ")! ~(@damage~)}
    #show {@enemy is @tempcond}
    #var damage 0
    #var enemies ""
    }
  #unvar enemy
  #unvar tempcond
  ;Yes, I make 2 variables null and delete 2
  ;others, this is because I don't want to
  ;delete @damage or @enemies, just in case
  ;there is a bug and I want to find the
  ;problem.
  } Attack

#TRIGGER {^Your lightning bolt &{string} {a|the|""} &{person}{!|.}%s~(%3~)} {
  ;@damstrings is a pre-set variable from
  ;the mud's damage strings. You will have
  ;to set this one up too.
  #if (%ismember( @string, @damstrings)) {
    #additem enemies @person
    #add damage %3
    }
  #gag
  ;Yes, I know I should use %d for the
  ;number, but it doesn't work for some
  ;odd reason. Always misses it....
  } Attack

#TRIGGER {^Mota's lightning strikes your foes!} {#T+ Attack}


Simple triggers are so powerful. I hope someone finds a good use for this little script. It has taught me alot about zMUD and makes me love the software even more. GREAT JOB ZUGG!!!!

-Seth-
Reply with quote
SethRizzen
Beginner


Joined: 07 Apr 2003
Posts: 15
Location: USA

PostPosted: Sat Jul 24, 2004 7:59 pm   
 
I have a slight change I want to make to my previous script, but I can't figure it out. Instead of #SHOW, I'd like to use #SUB. The reason is that #SHOW will just put it on a new line instead of replacing the lines it gags. I have not figured out how to sub it with the variables I've created with the trigger. I've tried the following:

Code:

#TRIGGER {^&{enemy} is &{tempcond}} {
    #T- Attack
    #if (%ismemeber( @tempcond, @conditions)) {
    #gag
    #sub {
      Your lightning bolt damages: %expandlist( @enemies, ", ")! ~(@damage~)
      #CR
      @enemy is @tempcond
      }
    #var damage 0
    #var enemies ""
    }
  #unvar enemy
  #unvar tempcond
  } Attack


The code above doesn't work, I think it is because you can't use the #CR command in the sub because it shows:
Code:
Your lightning bolt damages: female bandit, male rogue! (12334);#CR;female rogue is DEAD!!


Some help would be appreciated.
Reply with quote
geniusclown
Magician


Joined: 23 Apr 2003
Posts: 358
Location: USA

PostPosted: Sat Jul 24, 2004 8:04 pm   
 
Try using the %cr function instead:
Quote:

#sub {Your lightning bolt damages: %expandlist( @enemies, ", ")! ~(@damage~)%cr@enemy is @tempcond}
_________________
.geniusclown
Reply with quote
SethRizzen
Beginner


Joined: 07 Apr 2003
Posts: 15
Location: USA

PostPosted: Sat Jul 24, 2004 10:51 pm   
 
Geniusclown,

%cr? There is no such function. Only thing I found was %crtonl(s), which doesn't apply here.

Thanx
Reply with quote
Danlo
Magician


Joined: 28 Nov 2003
Posts: 313
Location: Australia

PostPosted: Sat Jul 24, 2004 11:12 pm   
 
That would be because it is not a function, but a predefined variable for a carriage return character. It forces a newline.
Reply with quote
SethRizzen
Beginner


Joined: 07 Apr 2003
Posts: 15
Location: USA

PostPosted: Sun Jul 25, 2004 12:51 am   
 
Ah, ok, I got it figured out. the %cr didn't want to work right at first, now it does. THanx peeps. Hugs & beer to all.

-Seth-
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