-
Notifications
You must be signed in to change notification settings - Fork 8
Hotkeys
Hotkeys are a powerful feature of MCM Helper that allows for the execution of a mod action when a key is pressed.
Mods can expose their hotkeys in the MCM, where users can configure which key to use for each action. Attempting to bind a key already bound to a mod action or an existing in-game function will result in a warning message (mod authors can suppress these on a case-by-case basis). Users may still choose to ignore the warning and keep the conflict if they wish.
All hotkeys that a mod provides must be defined in MCM\Config\ModName\keybinds.json
.
A hotkey must have an ID, a short description (for conflict resolution purposes), and an associated action.
Calls a Papyrus function on the specified form.
Calls a global Papyrus function on the specified script.
Sends the OnControlDown
/OnControlUp
event to the specified form with the keybind's ID as the control name.
This action type can be used to determine whether a key is currently being held down.
Runs the specified console command. This will also log the command to the command console.
{
"$schema": "https://raw.githubusercontent.com/Exit-9B/MCM-Helper/main/docs/keybinds.schema.json",
"modName": "MCM_Demo",
"keybinds": [
{
"id": "demoHotkey1",
"desc": "Display Messagebox via CallFunction",
"action": {
"type": "CallFunction",
"form": "MCM_Demo.esp|800",
"scriptName": "MCM_DemoScript",
"function": "ShowMessageBox",
"params": ["Hello world!"]
}
},
{
"id": "demoHotkey2",
"desc": "Display Messagebox via CallGlobalFunction",
"action": {
"type": "CallGlobalFunction",
"script": "Debug",
"function": "MessageBox",
"params": ["Hello world! (via global function)"]
}
},
{
"id": "demoHotkey3",
"desc": "Toggle Menu Display",
"action": {
"type": "RunConsoleCommand",
"command": "ToggleMenus"
}
},
{
"id": "demoHotkey4",
"desc": "Notification Demo",
"action": {
"type": "SendEvent",
"form": "MCM_Demo.esp|800",
"scriptName": "MCM_DemoScript"
}
}
]
}
The form
field accepts the plugin name and the form ID of the form that you want to call a function on. In most cases, this form is a Quest.
For example, if your quest has the formID 0000173E, then you would specify "MyMod.esp|173E" as the form parameter. This, along with the scriptName
property, tells MCM Helper where the function is located.