[Home] [Downloads] [Search] [Help/forum]


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  General
. . -> [Subject]  XML re-imports?

XML re-imports?

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page


Posted by Larkin   (278 posts)  [Biography] bio
Date Mon 28 Feb 2005 01:50 PM (UTC)
Message
I'm trying to maintain my triggers, aliases, etc, in a collection of XML files. I have them broken up into their various groups, so several files, to keep from getting super-huge files that I can't easily examine and update.

Since I'm still in the early stages of writing things and making several changes to the triggers and scripts, I am wondering if it's possible to have some sort of "master XML file" that imports all of my other XML files. What I want is basically to wipe out nearly all of my settings (but not quite everything, as it's just the triggers for curing and defense stuff) and then an easy way to programmatically re-import everything instead of having to go to the menu and the dialog and select the dozen or more XML files one-by-one to be imported.

I had hoped that there would be a script function to accept a filename to import settings, but all I found was ImportXML that takes the actual XML string and no filename option. I'd like to have a script function for re-installing my combat system all at the touch of a button (so to speak).

Any help on this? Is it even possible?
[Go to top] top

Posted by Ked   Russia  (524 posts)  [Biography] bio
Date Reply #1 on Mon 28 Feb 2005 02:14 PM (UTC)
Message
If you are trying to implement switching a combat system on and off using that, then that's not the best way to do it. That aside though - why not write your own function that will accept a filename, read the text from the file, and then pass it on to ImportXML?
[Go to top] top

Posted by Larkin   (278 posts)  [Biography] bio
Date Reply #2 on Mon 28 Feb 2005 02:28 PM (UTC)
Message
I'm certainly not trying to switch the system on and off. I'll do that with a few flag variables.

No, what I'm trying to do is maintain a version of all my settings nicely organized in XML files and be able to import them on other computers or other character worlds or even just to maintain versions of the scripts more easily. Wiping out the settings is easy enough (though it would be easier if it used a hierarchical group structure, similar to folders in zMUD), but importing the settings fresh is difficult.

I had thought about loading the entire XML file into a string variable and passing it to ImportXML, but I'm afraid that even with my splitting up of the settings that such a string would be too large for the system to handle effectively.
[Go to top] top

Posted by Flannel   USA  (1,230 posts)  [Biography] bio
Date Reply #3 on Mon 28 Feb 2005 05:17 PM (UTC)
Message
There is File > Import, but as far as being programmed, all you can do with it is DoCommand which brings up a dialog.

What about writing a script which uses FSO to write the world file directly. Take a list of files and tack them together in the right order when youre done.

It might be best to keep a couple of files, one for the header (world settings), one for all the triggers, one for all the aliases, etc, (so you can just tack things on the end of the respective files instead of having to insert in the middle, since that would get messy), and then close them after youre done writing (with </triggers> for instance) and then assemble them all into an XML file (which you can then simply open as a world).
Since thats all importing does, and you don't need MC to do anything special with them (except generate a worldID, remember to generate a new worldID).

~Flannel

Messiah of Rose
Eternity's Trials.

Clones are people two.
[Go to top] top

Posted by Larkin   (278 posts)  [Biography] bio
Date Reply #4 on Tue 01 Mar 2005 05:26 PM (UTC)
Message
I've found that the include tag in the world file is very useful for what I'm doing, except that it won't allow me to dynamically update my settings while still keeping the world open. I'll edit the majority of them offline and just make little fixes as I need to, so this isn't a major problem. I'm just glad that I don't need to use plugins with complex interfaces or mash all my settings into one huge world file. Thanks for making such a versatile little client, Nick! Heh.
[Go to top] 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.


14,613 views.

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

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

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at HostDash]