"Copy" bug

Posted by Terry on Sun 18 May 2008 05:00 AM — 6 posts, 27,462 views.

USA #0
I was using the "copy trigger" feature in v4.24 just to test it out. Anyway, it did a weird thing with ==. Instead of it showing up corretly, it copied as ">". Here's the script as how it copied.

<triggers>
  <trigger
   enabled="y"
   match="^(.*?) is now level (.*?)\!\!$"
   regexp="y"
   send_to="12"
   sequence="100"
  >
  <send>if %2 &gt; 14 then
  Send ("chat Woo\! Level ", %2, "\! \:D")
end -- if</send>
  </trigger>
</triggers>
Netherlands #1
It should be fine again once you paste it in MUSHclient.

XML requires that < (&lt;) and > (&gt;) be escaped, same with some other characters like & (&amp;) and such.
USA #2
When I copy things into the website, should I edit things that are escaped? Or should I leave them as is? Or is it just personal preference?
USA #3
Leave them escaped so that others can just copy and paste it into their mushclients, and try it out.

-Onoitsu2
Australia Forum Administrator #4
As the other posters have said, this is not a bug, it is a feature. ;)

Imagine in your trigger you wanted to say something with < or > symbols in it, like this:


Say ("Woot! </send> I levelled!")


I know this might seem a strange thing to say, but imagine you wanted to.

Now the trigger parser needs to know the difference between the </send> at the end of the "send" text, and a </send> in the middle of it.

Thus it converts it to:


Say ("Woot! &lt;/send&gt; I levelled!")


However if you try to paste the trigger back into MUSHclient (try it, on a different world) then it works symmetrically, and converts the special characters back again.

Since the converted text uses ampersands, they too have to be converted. Thus:


Say ("It is raining cats & dogs")


becomes:


Say ("It is raining cats &amp; dogs")


Quote:

When I copy things into the website, should I edit things that are escaped?


You should leave them as is, or the triggers or whatever they are could become unusable.

However there is a "gotcha" with the forum (that does not apply to simply copying and pasting triggers at home).

If you use square brackets, or backslashes, and are using "forum codes" then they should be escaped. You used the [code] tag in your original post. Imagine what would happen if you had wanted to say:


Say ("Woot! [code] I just levelled!")


The forum would interpret [code] as a forum tag.

To avoid this, if you are posting on the forum you should "escape" out square brackets and backslashes. Fortunately MUSHclient gives you a menu item to do just that. See the Edit menu -> Convert Clipboard Forum Codes (Shift+Ctrl+Alt+Q).

So, for posting on the forum, and if you are using forum codes, do this:

  • Copy the trigger/alias/timer using the Copy button
  • Close the world configuration dialog, so you can use the normal MUSHclient menus
  • Press Shift+Ctrl+Alt+Q to convert Forum Codes - you will get a dialog confirming how many were converted (it might be zero)
  • In your forum posting, type [code]
  • Paste in the converted trigger/alias/timer
  • In your forum posting, type [/code]
  • You are done!


So you would see, in my earlier example, while you are typing in the post:


Say ("Woot! \[code\] I just levelled!")


(I did it twice to show the idea, as doing it once is only visible when you are doing the posting).
Amended on Sun 18 May 2008 09:28 PM by Nick Gammon
Australia Forum Administrator #5
I have amended the forum post http://mushclient.com/copying to explain this stuff for future reference.