File information

Last updated

Original upload

Created by

Dylbill

Uploaded by

dylbill

Virus scan

Safe to use

Tags for this mod

About this mod

Modders resource to help speed up the process of creating a MCM. Create and test an MCM layout in game and auto write a source script based on your layout.

Requirements
Permissions and credits
Donations

     
Check Out My Other Mods


Description

This is a modders resource to help speed up the process of creating a MCM. Create, edit and test a MCM in game and auto write a source script based on your layout.

Features
- Add, remove, swap, rename and duplicate pages. Duplicating a page will duplicate all of the options in that page as well. 
- Copy, Cut, Paste, Delete and Edit menu options. 
- Auto write Save to Json and Load from Json functions. 
- Write Save to Json and Load from Json functions to an existing source script.
- Save and Load MCM layouts to and from Json files.

Notes - Please Read!!!
After changing anything with pages, or loading a layout from Json file, you have to exit and re-enter the MCM Creator menu to see the changes. This is because using ForcePageReset doesn't update pages. The Main Page is the first page you see when opening your menu. You can add more pages after this.

Property names will be auto generated. You can add a prefix for property names. Do this before adding and editing your menu options. The property names that are auto generated are based on the option type you choose. So for example if your prefix is MyMod_ and you choose a text option the property will be auto named something like MyMod_Text_10. You can also write your own property names if you wish.

To add a menu option, click on any empty _ option, which will enter edit mode. Choose the option type and set your text and parameters, click save and return to go back to preview. The default option values in edit mode are what will be written to the source script.

For slider options, when choosing the number of decimals to display you can also add text after. So 0% will show "50%" if your slider value is 50.

For input options, if Use GlobalVariable is checked, it will bind the input to a global variable and assume a float for the value. 
If not using a globalVariable, it will use property types based on your default value text. If the value is "5.0" it will use a float property. If "5" it will use an Int property. If it uses any other text it will use a String property.

Shortcuts for menu options: 
Left Ctrl + C = Copy 
Left Ctrl + X = Cut 
Left Ctrl + V = Paste
Left Ctrl + Delete = Delete / clear
Left Ctrl + E = Edit 

You can only paste to empty option slots.

Using these shortcuts on option will open the option. Just press Tab to close. I did try to detect options with OnOptionHighlight, and while this works, forcePageReset only works when you actually select an option, which means if the option isn't selected you have to exit and re-enter the page to see the changes the shortcuts made. So, opening the option was the less annoying route in my opinion.

For keymap option types, you have to press it twice, because there's not an OnKeymapOpen event. So for instance to copy, Hold Left Ctrl, press C, when the option opens keep holding Left Ctrl and press C again to copy the keymap option.

These shortcuts will work on all options except Header options, this is because header options can't be selected and don't have an OnOptionHighlight event. To get around this you can press Left Shift + C, X, V, Delete or E and it will point to the option directly above your current highlighted option. Left Alt + C, X, V, Delete or E will point to the option directly below your current highlighted option. So to copy a header option, highlight the option below it and press Left Shift + C.

After writing the source script, you can find it in Data/Scripts/Source/MCMCreator. Move it to your source folder to compile after writing. 

Json functions to existing script:
Notes on writing Json save and load functions to an existing source script: 
To do this, place a source script in Data/Scripts/Source/MCMCreator. Choose the script when selecting Write Json Functions to .psc File. It will then copy the source script to Data/Scripts/Source/MCMCreator/ExistingJsonOutput and write the SaveToJson and LoadFromJson functions at the end of the script.

This works in 2 parts. 1, it will search for properties you've checked that aren't in functions or events, and write Json save and load functions for those properties. 

Example: 
If your source script has Int Property MyInt Auto. It will write
JsonUtil.SetIntValue(FileName, "MyInt ", MyInt)   in the SaveToJson function and 
MyInt = (JsonUtil.GetIntValue(FileName, "MyInt"))   in the LoadFromJson function. 

2: It will force select state options at the end of the LoadFromJson function. So for example if you had AddKeymapOptionST("OID_MyInt", "My Keymap", MyInt)
In the loadToJson function it will write. 

GoToState("OID_MyInt")
OnKeyMapChangeST(MyInt, "", "") 

You will have to edit these functions as not every property needs to be saved and loaded. Also you only need to force select options that run other functions than simply setting property values. 

This feature only writes the functions, you still have to use them elsewhere in your script.

Requirements
SKSE
SkyUi
PapyrusUtil

Installation
Extract to your data folder and check in your load order. Use manual installation, not a Mod Manager so that the folders are actually in your Data folder.