Version 3.21 released - with XML file format

Posted by Nick Gammon on Thu 16 May 2002 06:35 AM — 2 posts, 11,297 views.

Australia Forum Administrator #0

XML world file format

I am pleased to release - for testing purposes - version 3.21 of MUSHclient, which reads and writes world files in XML format.

This new format is a radical departure from the proprietary format used for world files (and trigger files, alias files and so on). The new files are intended to be "human readable", as well as quickly parsed by MUSHclient when you read them in.

As an example, a minimal world file might look like this:


<muclient>
<world
   defaults="y"
   name="Realms of Despair"
   player="Boris"
   password="swordfish"
   site="smaug.org"
   port="4000"
   connect_method="2"
   > 
</world>
</muclient>

This example takes the defaults for most things, and merely specifies enough to connect (ip address, port, player name, password, connect method).

There are quite a few advantages of the new world file format.

  • Forwards compatibility - older versions will be able to read world files produced by newer versions, with only a few warnings if it doesn't recognise new options.
  • Backwards compatibility - newer versions will be able to read world files from older versions.
  • Human readable - you can browse the file to see what options you are using.
  • Snippets - you can distribute snippets (eg. 2 triggers, 3 aliases, and 4 variables) in a single file. Snippets can be read from a file or direct from the clipboard.
  • Copy and paste - you can now copy and paste triggers, aliases etc. from one world file to another.
  • Greatly simplifies adding new options in future, without having to worry about forwards/backwards compatibility of world files. It will now be practical to add new options or features on request, but retain compatibility with earlier (or future) world files.

The ability to import snippets from the clipboard will make it much easier to distribute suggestion via the forum (and emails), as you can simply copy and paste the snippet directly into the appropriate section. For example, here is a single trigger:


<triggers>
  <trigger enabled="y" match=" The * door is closed." sequence="100">
  <send>open %1 door</send>
  </trigger>
</triggers>

As you can see from the examples above, XML is quite similar to HTML, however it has a tighter syntax. There are various books on XML you can read, and plenty of material on the Internet.

See the web page http://www.w3.org/XML/ for more details about XML.


World files not compatible with earlier versions

WARNING - as this version writes files out in a completely different format to previous versions the world files produced are NOT compatible with earlier versions.

You are strongly advised to BACK UP (make a copy of) all your existing world files (and any other files that MUSHclient produces, such as triggers, aliases etc.) before using this new version.

The file saving/loading has been carefully tested, however in any major change like this there are likely to be some teething problems. You have been warned. :)


Download

You can view the release notes for version 3.21

You can download MUSHclient 3.21 (1.07 Mb) now, by ftp, or http ...

If there are any problems, please post messages to the Bug Reports, Suggestions, or General parts of this forum.


MuClient

In case you are wondering about the references to "muclient" in the world files, we are planning to rename MUSHclient as MuClient in the future, to get away from the idea that it is only for MUSH games. In anticipation of this, the world file identifier is "muclient" not "mushclient".


File format

We will shortly produce some extra web pages which describe the XML format used in MUSHclient world files, however in the short term you can always produce an example with MUSHclient, edit it in Notepad or any other text editor, and see for yourself what the general format is.


Backwards compatibility

This version will automatically detect whether or not it is reading an older-style world file, or an XML world file, by reading the first few bytes of a world file, and comparing it to a list of valid XML file starting signatures. In short, if a file starts with one of the following strings it is considered to be an XML file:

    
    <?xml
    <!--
    <!DOCTYPE
    <muclient
    <world
    <triggers
    <aliases
    <timers
    <macros
    <variables
    <colours
    <keypad
    <printing

The above strings may be preceded by a reasonable amount of whitespace (spaces, tabs, newlines) (up to 300 bytes).


New features

To start the ball rolling, and encourage you to test it, the new version supports various things that will make managing multiple worlds much easier:

  • Import triggers, aliases, timers, variables from the clipboard, or a file.
  • Copy and paste triggers etc. from one world to another.
  • Have fun editing world files in your word processor to see what options are available.
Amended on Tue 20 Nov 2007 04:12 AM by Nick Gammon
Australia Forum Administrator #1
The conversion of triggers with "@" in them (variables) is flawed in version 3.18, 3.19, 3.20 and 3.21.

Also, 3.21 has minor problems in the way it reads XML files in for triggers.

I suggest not using this version, but going direct to 3.22.

However, back up your world files first!