Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ General ➜ Removing new line?

Removing new line?

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


Posted by Shady Stranger   USA  (45 posts)  Bio
Date Sun 25 May 2014 05:08 PM (UTC)
Message
I am trying to create an alias that will send several paragraphs of information on one line and keep the formatting. For example, if I were to copy/paste the following poem into the command line, it would automatically send each line of the poem as a new line. How do I remove the new line function, using an alias to do it?

Quote:

TWO roads diverged in a yellow wood,
And sorry I could not travel both
And be one traveler, long I stood
And looked down one as far as I could
To where it bent in the undergrowth;

Then took the other, as just as fair,
And having perhaps the better claim,
Because it was grassy and wanted wear;
Though as for that the passing there
Had worn them really about the same,

And both that morning equally lay
In leaves no step had trodden black.
Oh, I kept the first for another day!
Yet knowing how way leads on to way,
I doubted if I should ever come back.

I shall be telling this with a sigh
Somewhere ages and ages hence:
Two roads diverged in a wood, and I—
I took the one less traveled by,
And that has made all the difference.


Basically, what I want to do is the following but without having to take the time to put it all on one line with \n.

Quote:

TWO roads diverged in a yellow wood,\nAnd sorry I could not travel both\nAnd be one traveler, long I stood\nAnd looked down one as far as I could\nTo where it bent in the undergrowth;\n\nThen took the other, as just as fair,\nAnd having perhaps the better claim,\nBecause it was grassy and wanted wear;\nThough as for that the passing there\nHad worn them really about the same,\n\nAnd both that morning equally lay\nIn leaves no step had trodden black.\nOh, I kept the first for another day!\nYet knowing how way leads on to way,\nI doubted if I should ever come back.\n\nI shall be telling this with a sigh\nSomewhere ages and ages hence:\nTwo roads diverged in a wood, and\nI took the one less traveled by,\nAnd that has made all the difference.
Top

Posted by Nick Gammon   Australia  (23,165 posts)  Bio   Forum Administrator
Date Reply #1 on Sun 25 May 2014 08:57 PM (UTC)
Message
Aliases are terminated by a newline, so this won't be easy to turn into an alias.

However what you could do is press Ctrl+I to open the Immediate scripting window, and then copy and paste your poem with a couple of extra lines, like this:


Send [[
TWO roads diverged in a yellow wood,
And sorry I could not travel both
And be one traveler, long I stood
And looked down one as far as I could
To where it bent in the undergrowth;

Then took the other, as just as fair,
And having perhaps the better claim,
Because it was grassy and wanted wear;
Though as for that the passing there
Had worn them really about the same,

And both that morning equally lay
In leaves no step had trodden black.
Oh, I kept the first for another day!
Yet knowing how way leads on to way,
I doubted if I should ever come back.

I shall be telling this with a sigh
Somewhere ages and ages hence:
Two roads diverged in a wood, and I—
I took the one less traveled by,
And that has made all the difference. 
]]


The square brackets make up a Lua multi-line string constant. That way the multiple lines (including the newlines) will be sent in one hit.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Shady Stranger   USA  (45 posts)  Bio
Date Reply #2 on Sun 25 May 2014 10:26 PM (UTC)
Message
I just tried that and it didn't work. Here's the output from the game, hopefully it will demonstrate what I am trying to accomplish.

Quote:

scribe

A frazzled scribe sighs while examining the tip of a feather quill.

A frazzled scribe asks, "Would ye like me to scribe a letter, application, note, document, charter, recipe, invitation, missive, or parchment (L/A/N/D/C/R/I/M/P)?"
p


A frazzled scribe asks you, "To whom shall I address a small parchment?"
Recipient's name:
myself

A frazzled scribe asks you, "What will this message will entail, as I will make a brief note of it."
In regards to:
test

A frazzled scribe asks you, "What would ye like to have as your message to myself?"
Message:
This is a test

This is a test

This is a test

This is a test --my input

A frazzled scribe asks you, "Who shall I address the message from?"
Signature:

A frazzled scribe finishes up the last of her writing and shows it to you.

It looks like a small parchment addressed to myself in regards to test.

___________________________________________________________


myself,

This is a test




___________________________________________________________


A frazzled scribe asks you, "Is this acceptable?" (Y/N/Redo)A frazzled scribe asks you, "Is this acceptable?" (Y/N/Redo)A frazzled scribe rips up a small parchment.
Huh?
HP: 185/185 ST: 113/113 Carry: 350/468 M: 0

Huh?
HP: 185/185 ST: 113/113 Carry: 350/468 M: 0


In order for this to work properly, I would have to send the message like this:

Quote:

This is a test\n\n This is a test\n\n This is a test\n\n This is a test


The reason for this is for making readable maps and artwork within the game. In order to make something like this, it would need to be made how it is supposed to look in notepad then go through and replace all the new lines (where the return/enter key was used) with \n so it can all be sent as one command. I was hoping to make an alias or other type of script to simplify this process.
Top

Posted by Nick Gammon   Australia  (23,165 posts)  Bio   Forum Administrator
Date Reply #3 on Mon 26 May 2014 03:34 AM (UTC)
Message
Have a look at the Edit menu -> Paste to world.

Have your message ready in Notepad (and copied to the clipboard), and then when you reach the line:

Quote:

A frazzled scribe asks you, "What would ye like to have as your message to myself?"


Hit "paste to world" (Shift+Ctrl+V). Then the prepared message is pasted, with a newline after each line. I don't see why that wouldn't work.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
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.


14,601 views.

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

Go to topic:           Search the forum


[Go to top] top

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