Multiline substitution

Posted by tobiassjosten on Mon 25 Apr 2005 09:49 AM — 8 posts, 32,077 views.

Sweden #0
I'm trying to trigger a couple of rows, but it just wont work for me. What I want is to shorten down this text:
You close your eyes momentarily and extend the range of your vision, seeking 
out the presence of Xxx.

It might be followed by either of these:
Though too far away to accurately perceive details, you see that Xxx is in the 
Xxx Xxx.

.. or:
You see that Xxx is at Xxx Xxx.


The result should be something like:
(Farsee) Xxx is in the Xxx Xxx

.. or:
(Farsee) Xxx is at Xxx Xxx


So far, I'm having problem with getting a trigger that will react to that first part. It might be my regexp syntaxt, but I think it looks good. How can I go about doing this in MC?

So far:
<triggers>
  <trigger
   enabled="y"
   match="^You close your eyes momentarily and extend the range of your vision\, seeking\nout the presence of (\w+)\."
   name="subFarsee"
   omit_from_log="y"
   omit_from_output="y"
   regexp="y"
   send_to="12"
   sequence="100"
  >
  <send>world.Note ("Triggered!")</send>
  </trigger>
</triggers>
Amended on Mon 25 Apr 2005 09:50 AM by tobiassjosten
Sweden #1
Got it working. Forgot that Rapture adds a trailing space after lines it wraps.. I had to check the multiline option for it to react which disabled the omit-option, how do I gag it now?
#2
Since you got it working, I can assume you added the options "multi_line='y'" and "lines_to_match='2'" to your trigger. If it doesn't gag it, it may be because it's multi-line. Try making separate triggers to gag each line and see if that works for you.

You could do it in a plugin, but then you'd be gagging it before the text even reached the triggers, if I understand correctly.
Sweden #3
Wouldn't be a problem, a sub-plugin does sound neat. Any suggestions as to how I could do this?

And yes, that's the changes I did to make it work. And that's the changes that stoped the trigger from gaging..
USA #4
Mutli line triggers cannot be gagged.
Since, it wouldn't make sense that after 20 lines showed up in the buffer, they magically disappeared (and your output scrolled down suddenly).

Are you sure you want a newline after seeking? Is it a hard newline sent by the server? or is it just wrapping?

Do you want to always gag the first line? The close eyes, etc? You will probably need to fall back to a series of triggers that turn each other on/off and gag.

He was talking about plugins and packets and stuff. Which, with something this big (this much text), wouldn't be feasible.
Amended on Mon 25 Apr 2005 07:55 PM by Flannel
Sweden #5
Ahh, and for that I could do world.TriggerOn("trigger-name") or something? Would need to set some sort of temporary variable to be sure that the first line has triggered, or else it -could- fsck something else up.. Unless there's some other way of making sure these lines follow eachother(?), I'll check this solution out. Thanks.
USA #6
Enabletrigger "triggername", (1/0) (1 for on, 0 for off)

You just have the second trigger disabled for the majority of the time, and then only enable it when the first line has triggered. And then a third trigger that matches on something else (like a prompt, or something) or a timer, that disables the second trigger (just incase the line doesn't come).

It's the old way of doing multiline triggers. So you can search for multiline trigger, or multiple lines trigger or something, and once you wade through the newer stuff, youll see lots of this. I remember a lot of 'who list' questions, so search for that too.
Amended on Mon 25 Apr 2005 09:00 PM by Flannel
Sweden #7
Sweet! Sounds like stuff I used to do in old zMUD, before the different trigger-types came. Once again, thanks.