Copying XML

Posted by Nick Gammon on Sun 17 Oct 2004 02:30 AM — 4 posts, 39,702 views.

Australia Forum Administrator #0

MUSHclient supports the use of XML on the clipboard for copying and pasting triggers, aliases, timers and so on.

This example shows how to go about using that.

Create a trigger in the trigger configuration list:

Close the trigger window, and then in the trigger *list* window you will see a "copy" button. Click that:

On your clipboard is now a copy of the trigger in XML format, like this:


<triggers> <trigger custom_colour="2" enabled="y" group="eat_drink" match="You are thirsty." name="thirst_trigger" sequence="100" > <send>get flask bag drink flask put flask bag</send> </trigger> </triggers>

You can now paste that into a different MUSHclient world, or email it to someone, paste it into a plugin, or post it onto the forum.

Amended on Mon 18 Oct 2004 06:31 AM by Nick Gammon
Australia Forum Administrator #1
Template:pasting
For advice on how to copy the above, and paste it into MUSHclient, please see Pasting XML.
Amended on Wed 19 Aug 2009 04:07 AM by Nick Gammon
Australia Forum Administrator #2
Also be aware that if you are posting triggers (or aliases/timers) onto this forum, and using Forum Codes, then you need to be aware that the forum converts certain formatting sequences (like [i] for italics, [quote] for quoting, and [code] for code sequences). If you use such things in your trigger/timer/alias they will be mis-displayed.

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 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!


The forum automatically detects the word "[code]" in posts, and turns Forum Codes on for you, so you don't need to manually do it.

The use of Forum Codes, in particular the [code] ... [/code] tag sequence is recommended, as that preserves the spacing of the original. Thus the trigger above, when posted to the forum, should look like this:


[code]
<triggers>
  <trigger
   custom_colour="2"
   enabled="y"
   group="eat_drink"
   match="You are thirsty."
   name="thirst_trigger"
   sequence="100"
  >
  <send>get flask bag
drink flask
put flask bag</send>
  </trigger>
</triggers>
[/code]


You will only see the forum codes when you make or edit the post, when the post is displayed they disappear because they are being acted upon by the forum.
Amended on Sun 18 May 2008 09:35 PM by Nick Gammon
Australia Forum Administrator #3
Note also that because the XML code needs to distinguish between tags like <send> in the trigger, and your possible use of the word "<send>" inside your trigger text, it needs to convert the following:

  • > becomes &gt;
  • < becomes &lt;
  • & becomes &amp;


This conversion is not a bug. If you subsequently paste the copied item back into MUSHclient (see http://mushclient.com/pasting) then they will be converted back.