[Home] [Downloads] [Search] [Help/forum]


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  General
. . -> [Subject]  Trigger Issue

Trigger Issue

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page


Posted by JL   (3 posts)  [Biography] bio
Date Sun 18 Mar 2007 11:52 PM (UTC)
Message
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?
[Go to top] top

Posted by Ked   Russia  (524 posts)  [Biography] bio
Date Reply #1 on Mon 19 Mar 2007 12:15 AM (UTC)
Message
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>

[Go to top] top

Posted by Shaun Biggs   USA  (644 posts)  [Biography] bio
Date Reply #2 on Mon 19 Mar 2007 12:37 AM (UTC)
Message
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

It is much easier to fight for one's ideals than to live up to them.
[Go to top] top

Posted by JL   (3 posts)  [Biography] bio
Date Reply #3 on Mon 19 Mar 2007 02:44 AM (UTC)
Message
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.
[Go to top] top

Posted by Ked   Russia  (524 posts)  [Biography] bio
Date Reply #4 on Mon 19 Mar 2007 03:03 AM (UTC)
Message
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>
[Go to top] top

Posted by JL   (3 posts)  [Biography] bio
Date Reply #5 on Wed 21 Mar 2007 02:09 AM (UTC)
Message
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.
[Go to top] top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


16,645 views.

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at HostDash]