Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.
 Entire forum ➜ MUSHclient ➜ General ➜ XML in save files

XML in save files

Posting of new messages is disabled at present.

Refresh page


Posted by Cage_fire_2000   USA  (119 posts)  Bio
Date Fri 17 Aug 2007 04:26 AM (UTC)
Message
This isn't directly related to MUSHclient but I was wondering what method you use to read/write XML files. I've been trying to use the MSXML2 interfaces in VB6 to record settings for my program, but it all comes out on one line, do you write it manually, or is there some method of getting it to come out on different lines and indented?
Top

Posted by Shaun Biggs   USA  (644 posts)  Bio
Date Reply #1 on Fri 17 Aug 2007 04:51 AM (UTC)

Amended on Fri 17 Aug 2007 04:54 AM (UTC) by Shaun Biggs

Message
As far as I can tell, having never used msxml, the newline is created with filevar.Append(Environment.NewLine). Although that might just create a <br>

It is much easier to fight for one's ideals than to live up to them.
Top

Posted by Nick Gammon   Australia  (23,122 posts)  Bio   Forum Administrator
Date Reply #2 on Fri 17 Aug 2007 09:54 PM (UTC)
Message
I write it manually, with the help of some "helper" routines to do things like convert the quote symbols, the < and > symbols, and so on.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Nick Gammon   Australia  (23,122 posts)  Bio   Forum Administrator
Date Reply #3 on Sat 18 Aug 2007 06:21 AM (UTC)
Message
As for reading, I wrote my own reading interface as well, as I could see that using standard libraries could add thousands of extra lines of code. I wrote my own interface, which is available as part of the publicly released source.

However what I would do these days is use Lua to save and load program settings - it was originally designed for that, and is very easy to use.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Worstje   Netherlands  (899 posts)  Bio
Date Reply #4 on Sat 18 Aug 2007 07:39 AM (UTC)
Message
I am glad you use XML and not Lua for it all, though. While Lua is a nice language, I think there is such a thing as over-using it. While I assume you mean using Lua for program settings alone (and not for plugins or worldfiles since I can't see how that would work), it still opens up a lot of awkward things.

Which reminds me about another thing I found weird when I delved into the registry months ago.. you use the Registry to save some information. Couldn't such information be better stored in a (state) file? Although people have worked around it for usb sticks and the like, I'm still not fond of the weird assortment of data MUSHclient stores in the registry. Since world files and such are all seperate, why suddenly add settings in the registry for them? I'd prefer my world.mcl to have a world.mcs (state) file rather than clutter up my registry.

Then again, maybe the MUSHclient backend could use some restructuring, from a user point-of-view. The Input>Macros screen is outdated and could use some reworking for the new Accelerator function which has far more uses. Input>Keypad has always been a bit odd to me, but can't really explain that one. Personally, I'd also prefer to see stuff grouped differently, in the interest of clarity for new users. But since I'm getting off topic, I might make a new topic about that. Sorry. MUSHclient is still the best, though. ^_^
Top

Posted by Shaun Biggs   USA  (644 posts)  Bio
Date Reply #5 on Sat 18 Aug 2007 08:08 AM (UTC)

Amended on Sat 18 Aug 2007 08:09 AM (UTC) by Shaun Biggs

Message
I'm pretty sure that Nick meant that he would write the XML reading and writing operations as Lua scripts. It would result in XML files being exactly the same as they are now, but the back would be easier to deal with and probably faster to boot.

I remember that there was a thread several months ago about changing the registry settings to a state file. There are benefits and drawbacks to both. I personally would prefer the state files simply because I think the settings would be much more organized without relying on trying to conform to MS' scheme. As it is, the settings are easy to edit if you can find them in the mess that is the windows registry.

As for the input->macro part, I agree completely. I stopped using the macro section ages ago and switched completely to accelerators, since they are more powerful, and at least as easy to manage. The input->keypad was a bit odd at first with the ctrl-keypad commands, but I use it constantly to fix things up out of habit. If you try to use accelerators for the keypad, they can be confused with the other keys that they represent when numlock is on, and I don't want to have to keep turning numlock on and off when I switch to MUSHclient. This is all, of course, assuming I have not missed any accelerator options to use the keypad only and not the arrow keys between the normal keys and the keypad.

It is much easier to fight for one's ideals than to live up to them.
Top

Posted by Shaun Biggs   USA  (644 posts)  Bio
Date Reply #6 on Sat 18 Aug 2007 08:13 AM (UTC)
Message
Actually, thinking about the Lua loading settings part, I'm probably wrong. Things like the loadstring commands can quickly load up tables of settings without taking up as much room as XML does. They would also be fairly easy to change manually, as I've done countless times to tables I've saved with the serialize module.

It is much easier to fight for one's ideals than to live up to them.
Top

Posted by Worstje   Netherlands  (899 posts)  Bio
Date Reply #7 on Sat 18 Aug 2007 08:49 AM (UTC)
Message
Heh, I guess you could interpret it either way. Anyhow, I've said what I wanted to, and made a new topic in the Suggestion forum with my views on how I feel MUSHclient could change for the better to leave some of the old 'weight' behind. What shape the state files end up in being, I don't care, so I didn't really mention it either anymore. :)
Top

Posted by Nick Gammon   Australia  (23,122 posts)  Bio   Forum Administrator
Date Reply #8 on Sat 18 Aug 2007 10:20 PM (UTC)
Message
Quote:

While I assume you mean using Lua for program settings alone (and not for plugins or worldfiles since I can't see how that would work), it still opens up a lot of awkward things.


I meant for everything. MUSHclient now has Lua built-in as a requirement, so it would actually save space to strip out the XML stuff, although it would need to read the old XML files for backwards compatability for a while.

As an example, instead of:


<triggers>
  <trigger
   back_colour="9"
   enabled="y"
   keep_evaluating="y"
   match="* says *"
   match_back_colour="y"
   match_text_colour="y"
   name="chats"
   send_to="4"
   sequence="100"
   text_colour="8"
  >
  <send>%0</send>
  </trigger>
</triggers>


You would have:


triggers = {
  {
   back_colour=9,
   enabled=true,
   keep_evaluating=true,
   match="* says *",
   match_back_colour=true,
   match_text_colour=true,
   name="chats",
   send_to=4,
   sequence=100,
   text_colour=8,
   send = [[%0]],
  }, -- end of one trigger

} -- end triggers


Not a heap of difference is there? However it means you could write a Lua script to easily read in your world file configuration and make some sort of global change.

However for the time being I can't really see the point in making the effort, as you would then have to move the variables from the Lua script space into MUSHclient internal variables, so that would take quite a bit of work.

Quote:

... you use the Registry to save some information. Couldn't such information be better stored in a (state) file?


Yes, that would be better. It was one of those things that worked OK for a couple of items, and just grew.

Quote:

The Input>Macros screen is outdated and could use some reworking for the new Accelerator function which has far more uses.


A lot of that awkward-looking stuff is a throwback to the days when the client did things in a simpler way, and then were left there for backwards compatability.

Things like:


  • Macros
  • Keypad configuration
  • Some entries in global configuration
  • The "Accelerator" script command


... all do similar things, sprinkled confusingly in different places.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


23,266 views.

Posting of new messages is disabled at present.

Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.