Problem with newlines with AppendToNotepad

Posted by Merseberger on Sat 22 May 2010 06:47 AM — 3 posts, 13,845 views.

#0
Hi all,

I am trying to use the Notepad functionality of LUA for the first time, and have run into an issue which I have not been able to figure out.

When I try to begin a newline with \r\n in my code, such as with

AppendToNotepad("Stats", "Here are some Stats\r\nHere are some more stats")

I get this error

Compile error
World: Aardwolf
Immediate execution
[string "Alias: "]:7: unfinished string near '"Here are some Stats'

If I remove the \r\n it works great, but I can't get a newline.

Is there something I'm missing to get this to work?

Thanks.
USA #1
I assume this is in the Send box of an alias, trigger, or other thing, not in a loose script. MUSHclient preprocesses that text, converting all escape sequences and replacing %1, %2 etc with the matched text, and @var1, @var2 etc with the associated MUSHclient variable contents. So you need your escape sequences to be able to survive that intact.

After being processed, \n becomes a newline. But what becomes \n after being processed? \\n does. So you should use \\r\\n instead, when your code is being evaluated in a Send box.
#2
Thanks :)