if (variable_instance_exists(id, "modmenu"))
modmenu.create({
title: localised string,
left_margin: localised int, // optional
left_value_pos: localised int, // optional
apply: {type: "OnChange" | "OnClose", func: callable}, // optional
save: {type:"Single" | "PerSlot" | "PerFile", name: string}, // optional
open_func: callable, // optional
close_func: callable, // optional
form: [
{
type: "Toggle",
title: localised string,
data_ref: {handle: handle /* optional(=global) */, var: string, default: any, ini_key: string /* optional */},
value_range: localised string,
no_save: bool, // optional
trigger_func: callable, // optional
change_func: callable, // optional
disabled: bool | callable, // optional
hidden: bool | callable, // optional
ref: {handle: handle /* optional(=global)*/, var: string} //optional
},{
type: "Slider",
title: localised string,
data_ref: {handle: handle /* optional(=global)*/, var: string, default: any, ini_key: string /* optional */},
value_range: localised string,
no_save: bool, // optional
revert_on_cancel: bool | callable, // optional
trigger_func: callable, // optional
change_func: callable, // optional
cancel_func: callable, // optional
accept_func: callable // optional
disabled: bool | callable, // optional
hidden: bool | callable, // optional
ref: {handle: handle /* optional(=global)*/, var: string} //optional
},{
type: "Button",
title: localised string,
trigger_func: callable,
disabled: bool | callable, // optional
hidden: bool | callable, // optional
ref: {handle: handle /* optional(=global)*/, var: string} //optional
},{
type: "Header",
title: localised string, // optional
disabled: bool | callable, // optional
hidden: bool | callable, // optional
ref: {handle: handle /* optional(=global)*/, var: string} //optional
}
],
additional_save_data_refs: [ // optional
{handle: handle /* optional(=global)*/, var: string, default: any, ini_key: string /* optional */}
]
});
modmenu.create - in addition to adding the menu to ModMenu's registry, this function will also validate the data and report any issues it finds so you can know why your menu data didn't work.
Various changes to reduce the coding effort for people using the tool:
varfield is now where the variable name livesdefaultfield, a default value which modmenu uses if save data is missing or var is not initialised.handlefield, this lets you change the handle fromglobalto any other type of handle, such as an object instance.ini_keyfield, this lets you override the key for the property in save data (normally just usesvarfield).Singlesave file,PerSlotsave files (1 per slot, max of 3),PerFilesave files (1 per game save data, same behaviour as vanilla saves).no_saveoption to disable save/load for specific properties.additional_save_data_refsto save/load any variables that aren't shown in the menu, uses 'data ref' formatapplydeclare call-back function for applying your settingsOnChange(of any menu item) orOnClose(of the menu)typeused to declare the type of a menu item, enables data validation from second pointopen_func(menu opened),close_func(menu closed),trigger_func(menu item clicked),change_func(menu item value changed),cancel_func(menu item selection cancelled),accept_func(menu item selection confirmed)_entype postfix. e.g.title: "Hello"title: [{lang: "en", val: "Hello"}, {lang: "fr", val: "Bonjour"}]The first entry in the array will be the default if the lang can't be found.revert_on_canceladded toSlidermenu items - if the user cancels out of the selection [X]/(B), the value changes will be reverted.ref- use to set a reference to the menu item, if you need to access it elsewhere in code.Hope is for a new api for creating menus following this format:
modmenu.create - in addition to adding the menu to ModMenu's registry, this function will also validate the data and report any issues it finds so you can know why your menu data didn't work.