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
Tribeek
Newbie


Joined: 01 Aug 2003
Posts: 5

PostPosted: Fri Aug 01, 2003 3:17 pm   

Multiple-Line Triggers
 
Ok, I've looked at some of the other threads about similar questions, but they all seemed to do something a little different from what I want, but I couldn't really tell what to change to make it work. So...

I want to make a trigger for something like this (generalized, not actual info from mud):

Firstword blah blah WEAPON NAME blah.

The problem I am having is that sometimes, based on how long the weapons name is, it might push the end of the string onto the next line, and sometimes, if the weapon name is more than one word, the second half of the weapon name is on another line.

The only info that I really want to get out of the trigger and stored in a var is the WEAPON NAME.

Can anyone help me?
Reply with quote
teknocide
Beginner


Joined: 15 Jul 2003
Posts: 25
Location: Sweden

PostPosted: Fri Aug 01, 2003 4:11 pm   
 
#CLASS {CaptureWeapon}
#VAR weapons {a two-handed mace|a sharpened stick|a broken bottle|a heavy looking brick|an umbrella}
#VAR capture {}
#TRIGGER {^Someone swings } {#VARIABLE capture {}}
#COND {*} {#IF (%concat( %line2, %line) =~ "({@weapons}) ") {#VARIABLE capture {%%1}}} {within|param=1}
#CLASS 0


* The weapons string-list should be filled with weapon patterns you would like to detect, as shown above.

* Change the trigger pattern to look like what you want. Do not capture anything. Remember to anchor with a ^

* The true field of the #IF-statement currently places the captured pattern in the capture variable. This can of course be altered to do whatever you wish. Just remember to use %%1.

(small note; this trigger will only capture one- or two-line patterns. It also NEEDS two lines -- even if the second one is a prompt or whatever -- in order to function as supposed. If one "weaponcapture"-line is directly followed by another, the trigger will most likely screw up..)
Reply with quote
Tribeek
Newbie


Joined: 01 Aug 2003
Posts: 5

PostPosted: Sat Aug 09, 2003 1:27 am   
 
Ok, now I have another problem with this. I tried using it for another situation, which also is on multiple lines. The text is something like this (only longer)

MOBname is not guarding right leg at all.

Now, the actual text is longer, and if right leg is all on either the first line or second line, its fine. However, when its like this (the dashes represent spaces, as multiple lines of something like that are indented, but it doesn't want me to type it like that):

MOBname is not guarding right
------leg at all.

it doesn't work. Is there a way to make it trigger properly?
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