Using variables and AppendtoNotepad

Posted by Chaosmstr on Mon 08 Sep 2014 11:28 PM — 2 posts, 12,669 views.

#0
So, I have three notepad windows opening up when I go online so that I can send various chat type msgs to the respective window.

Tells, Says, and Gossips

I can't get the trigger to move to a new line after inserting the text into the appropriate window.

<triggers>
<trigger
enabled="y"
match="* tells you *"
send_to="12"
sequence="1"
>
<send>AppendToNotepad ("Tells", "%0\r\n")</send>
</trigger>
</triggers>


This gives me an error of


Error number: 0
Event: Compile error
Description: [string "Trigger: "]:1: unfinished string near '"John tells you Boo! '
Called by: Immediate execution

Just the %0 appends it to the notepad window fine, but puts it all on the same line.

What am I missing here?

CM
Australia Forum Administrator #1
The "send to" box preprocesses \r and \n before it reaches Lua.

So what Lua saw was:


AppendToNotepad ("Tells", "%0
")


That gave an error. To fix this, double the number of backslashes:


<triggers>
  <trigger
   enabled="y"
   match="* tells you *"
   send_to="12"
   sequence="1"
  >
  <send>AppendToNotepad ("Tells", "%0\\r\\n")</send>
  </trigger>
</triggers>


Template:pasting
For advice on how to copy the above, and paste it into MUSHclient, please see Pasting XML.