Save/Backup/Restore xml?

Post Reply
Nyyrazzilyss
Posts: 334
Joined: Thu Mar 05, 2015 2:53 am

Save/Backup/Restore xml?

Post by Nyyrazzilyss »

My package currently consists of various created data files + the xml file.

I've written a backup command for it that copies/restores all the script created data files to another folder. How might I go about having it copy/save the current xml file there also?

I might be wrong, but it appears once the original xml is loaded, it's saved as a dated xml in the 'current' folder of the profile every time mudlet is exited. That xml (in the 'current' folder) is what's loaded on next restart. Would just copying the most recent xml from that folder to another directory work as a backup?

Other then just exiting, clicking the 'save profile' button also appears to save a new xml into the current folder (example: 20-06-2016#11-23-24.xml). Is there a Mudlet command I can call to create that file (without having to click save/or exit)?

The other half of that would then be restoring. If I copied that same file back to the current folder and gave it a more recent name/timestamp, would it then be loaded when mudlet starts? Would using the installModule command on that xml cause it to be loaded properly replacing the existing loaded script if I were to do this while mudlet is running, not restarted?

If a restart of mudlet is required to load the xml file from the 'current' folder, is there a command I could use to force a mudlet restart?

Does anyone have a script written (for any mud) with coding done for backing up and restoring xml files?

(edit)

I found the resetProfile() command. Would the expected functionality of this command be to reset / load the most recent xml file present in the 'current' folder?

User avatar
SlySven
Posts: 1023
Joined: Mon Mar 04, 2013 3:40 pm
Location: Deepest Wiltshire, UK
Discord: SlySven#2703

Re: Save/Backup/Restore xml?

Post by SlySven »

There does not seem to be a Lua command that does the same save/backup of the profile that the above mentioned editor button does.

The latter does, as you suggest, create a new "date-stamped" named XMLfile containing the profile "state".

For the record, I do want to change the format of the names in the future, so that they are to be "yyyy-MM-dd#hh-mm-ss..." for all places where this type of file-name is used (replays, logs, maps and profiles) putting the day of month first might have looked nice but it is really unhelpful when managing files and doing what is common in the Far East, of putting the most significant data item first (year) would make the date sorting order the same as an alphabetical one!

That "resetProfile()" command does seem to do what you state...!

I can consider adding a lua command to force a backup (and to return the file name used to help scripters!) - I'll put it on my todo list - note that this "backup" is a complete copy of the profile and using it for a different profile might not behave quite as anticipated/may break things.

Another feature that I experimented with but never finished was functions to retrieve the "user name" and to send that and the stored password to the server (without displaying/revealing the latter to the Lua environment) and to make it possible to stop the connection process from automatically sending them on connection (this happens on a timer currently). Knowing the character name could be useful for a "system" that is shared between different profiles using the "modules" system to share common code units between profiles - that might be of use here as well I suppose.

Post Reply