Description

A handy utility script for addon developers using MCM. Simple-to-configure storage for options in the players savefile.

Preview
[1.5.1 / MCM 1.3] MCM Savefile Storage
Comments
ravenascendant
ravenascendant

"You may distribute this together with your addon, as long as you keep the script header intact."

I'm tempted to do just that when i update to fix the collections bug :)

Reply Good karma Bad karma+2 votes
Diphenhydramine-HCl Author
Diphenhydramine-HCl

Sure, sounds great! Speaking of collections: This script can't handle them -- I might update it to do that when I find time. But since I haven't seen anyone else use that feature yet I doubt too many people will have a problem.

Also, I've been using your fix (j instead of i) locally and haven't experienced a single bug. It also didn't make any problems when I was adding a menu without collection in-between my collection menus. Apart from that I didn't do any testing, just normal usage.

Reply Good karma+1 vote
ravenascendant
ravenascendant

If you implement support for arbitrary path length then it would be dph_mcm_save_storage.register_module("collection/example_example")

this would also lead in to support for specifying individual options that a moddev would like saved to the save rather than all or nothing.

Reply Good karma Bad karma+1 vote
Diphenhydramine-HCl Author
Diphenhydramine-HCl

You're right, that's way more elegant and simple. I've updated the script.

Reply Good karma+2 votes
ravenascendant
ravenascendant

You now have a credit in MCM. I did alias the function into mcm for clarity/brevity sake, but ppl that are calling it directly will have no problems as I did not edit your script in any way.

Reply Good karma Bad karma+1 vote
Diphenhydramine-HCl Author
Diphenhydramine-HCl

Perfect, thanks for the credit.

Reply Good karma+1 vote
Ishmaeel
Ishmaeel

Will it break savegame compatibility?

Reply Good karma Bad karma+1 vote
Diphenhydramine-HCl Author
Diphenhydramine-HCl

No, when the script loads a modules state, it will check whether an entry in the mdata table exists for it, and skip it if that isn't the case (resulting in unchanged MCM options -- the same they were before loading the savegame). When it saves a modules state it will also do a check for nil, and initialize the appropiate entry in the mdata table the first time it's run for a given savegame.

You can safely remove the script and still load savegames with MCM options in it, it'll just be dead data. You can also remove the data from a savegame, and that'll only result in losing the stored MCM options.

EDIT:
The relevant code for both checks is at lines 76 and 91 if you want to take a look yourself.

Reply Good karma+2 votes
ravenascendant
ravenascendant

Nope it uses the Marshal library to store information in the .coc portion of your save file. Abandoned data there is never read out and very unlikely to break any thing.

Reply Good karma Bad karma+2 votes
Post a comment
Sign in or join with:

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.

Tags

[1.5.1 / MCM 1.3] MCM Savefile Storage has not been tagged yet.