Trigger Issue

Posted by JL on Sun 18 Mar 2007 11:52 PM — 6 posts, 24,130 views.

#0
Is there a way to establish a trigger that will allow me to send a blank line to myself between blocks of text? Essentially, I want to insert a blank line between one paragraph and the next.

I've tried using regular expressions, I've tried tweaking the display settings and nothing works. With regular expressions, every time it comes across my trigger-expression it performs the requested action. So I end up with three+ lines separating one paragraph from the next. If I could just figure out how to limit <expression> to <block of text> I'd be good to go.

Suggestions?
Russia #1
You can try this trigger (scripting must be enabled and set to Lua):


<triggers>
  <trigger
   enabled="y"
   keep_evaluating="y"
   match=".*?$"
   regexp="y"
   send_to="12"
   sequence="1"
  >
  <send>print("\r\n")</send>
  </trigger>
</triggers>

USA #2
Could you explain a bit more how you're matching to separate the paragraphs? Maybe post your trigger and an example of the mud output what you're trying to separate? If it's something as simple as a line that starts with a tab, then ^\t.* should work as a trigger.

Ked's trigger will just spit out blank lines after every line of text, which might be what you want. The .*?$ can also be shortened to just * with no regex, or .* with regex
#3
The trigger I'm using is relatively simple, compared to most I've seen here. The problem might even be with it, though I couldn't find a way to just exclude everything but the last line of the paragraph.

The trigger: \.$ (expression: @pemit me=%n)

Also - I'm really not familiar with scripts and such, so any help on that will be appreciated.
Russia #4
From that trigger expression it seems like you treat the end of a paragraph to be a line with a full stop as the last character on it. Technically speaking, a newline marks the end of a paragraph, so if your MUD's server wraps long lines by breaking them up with newlines then you'll have many small paragraphs where you'd expect a single one.

But that aside, you seem to be trying to send a newline to be echoed back at you by the server. This would explain how you manage to get more than one blank line after each paragraph: by the time your newline reaches the server and comes back to you, the server might have already sent several other paragraphs, which were matched by the trigger, and you end up with batches of incoming newlines.

What you probably want is to display the newline in the client's output window, and to do that you don't need to send anything to the server - you don't even need scripting if you don't want to do that. You just need to display the newline by sending it to output from the trigger. Like this:


<triggers>
  <trigger
   enabled="y"
   keep_evaluating="y"
   match="\.$"
   regexp="y"
   send_to="2"
   sequence="1"
  >
  <send>\r\n</send>
  </trigger>
</triggers>
#5
Thanks for all the help. I'll try Ked's solution since it's the only one I think I can understand and likely won't mess up in the process.