Where are the files for Profiles and Packages stored, and how do I save and restore them?

Post Reply
Laps
Posts: 25
Joined: Sat Feb 01, 2020 8:34 am

Where are the files for Profiles and Packages stored, and how do I save and restore them?

Post by Laps »

I'm just starting out with Mudlet, and I'd like to make sure the effort I put into making triggers, aliases, scripts, timers, keys, and variables is regularly backed up (and someday possibly even under some sort of version control, if I can rig it up).

To do that with confidence, I need to know where Mudlet stores the file(s) where all my stuff is persisted, and also how to load those the file(s) back into Mudlet when I want to use them elsewhere or revert to a previous version.

Either the Wiki page for Profiles and Packages is lacking, or I'm not looking in the right place for the documentation on this info:
https://wiki.mudlet.org/w/Manual:Profile_and_Packages

So far, here's what I've tried:

Profiles

Suppose I'm using a profiled named MyProfile.

The Wiki says:
To export your entire profile e. g. to make a backup on a flash drive, use the "save profile as" button.
When I save a profile via the Save Profile As button on the Script Editor, it creates a file named MyProfile.trigger in the directory that I specify.

Packages

The Wiki says:
To export just one item, you can select it and hit the 'Export' button on top of the script editor.
This doesn't seem particularly useful for my purpose - I want to back up everything. That said, note that it saves a some-filename.xml file wherever I specify.

From the Wiki:
To export many related items as one package, go to the Toolbox → Package Exporter (experimental).
This sounds closer to what I need, but still saving a Profile seems better (just wholesale save everything into a single file, assuming the answers to the above questions confirm that.

When I do this, it saves a some-filename.mpackage file where I specify.

Questions:
  1. Does the .trigger file contain everything I need to reload my entire profile (i.e. everything I've modified in all the tabs in my Script Editor), or are there other files needed? Part of the reason I ask is there are references to other files/folders in thie thread, but I can't find any real documentation around it: viewtopic.php?f=9&t=4651&p=22080
  2. Is there a keyboard shortcut for saving the profile? I'd like to be able to define variables from the command line and have them saved permanently.
  3. Is there a function I can call to force the profile to be saved?
  4. Is it possible to somehow select this .trigger profile file from the Select a profile to connect with dialog (via Games > Play)?
  5. Is there a programmatic way to force my .trigger profile file to be saved, from within a script?
  6. What's the difference between opening the .mpackage file from the Script Editor's Import button and the Package Manager's Install button?
  7. What's the difference between a .trigger file and a .mpackage file with respect to loading/importing it? The difference seems to be primarily around how much is saved when the file is created.
----

(Sidenote: I had to put a space before .org above because we can't add full links to the Wiki from within a forum post? I just got an error message: You can’t post image, email or url links that are external to this domain. Please remove mudlet .org)

Edit by administrator (SlySven): I've put a functional link back in - because I can; new users are restricted in insertion of URLs to prevent the rogue ones, who occasionally get through our testing process, spamming us senseless... :geek:

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

Re: Where are the files for Profiles and Packages stored, and how do I save and restore them?

Post by SlySven »

All those triggers/timers/aliases/keybindings and scripts are stored in a date stamped .XML file in the /current sub-directory of the sub-directory of UsersHomeDirectory/.config/mudlet/profiles (on Windows read / as \ !) named after the profile's name. When you start Mudlet up and select a profile it will automatically choose the newest one but there is a drop-down box that will enable you to select an older backup to load instead:
Screenshot_20200223_113018.png
Not shown in that image above (because it predates the addition of the feature) is one marked with a floppy disk icon - that indicates the auto-saved one that Mudlet now maintains every few minutes (in the background) so you can avoid loosing things if it should ever crash...

OTOH For large profiles (with lots of variables of long strings - like map room descriptions held as a lua table within the lua sub-system) those files can get to be a significant size and you may want to eventually clear out older ones!

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

Re: Where are the files for Profiles and Packages stored, and how do I save and restore them?

Post by SlySven »

To answer your questions as best I can:
  1. No.
  2. There might be - I can't recall what it was for saving the whole profile
  3. Yes: see the Wiki entry for: saveProfile(...)
  4. Yes - see previous answer
  5. same as 3. - though note that something exported from the editor is just that bit of the profile
  6. Not sure if opening a package/module from the "Import" button works the same as via the package manager dialogue - by default, I'd recommend the latter
  7. An .xml or (.trigger the older extension which is a bit misleading as now more than just triggers can be saved in an XML form) only contains the .xml for those items; an .mpackage (which is actual a .zip format archive file) should contain:
    1. a config.lua file in the root directory which (currently) only holds the actual name of the package as a line of lua script (but which eventually is likely to contain more metadata about the package when we can get around to it)
    2. An .xml file in the root directory with the same name as the package containing all the different types of Mudlet items (aliases/buttons&menus&toolbars/keybindings/scripts/timers/triggers)
    3. It can also contain other files - possibly in a file-system tree with organised sub-directories - e.g. sound files, fonts, icons which the profile can load and use as part of the package...

Post Reply