Modding:Key Mapping (Commands)

From Caves of Qud Wiki
Revision as of 01:18, 17 September 2019 by Egocarib (talk | contribs) (To be continued... (submitted bug report because I can't actually get this feature to work))
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
This page is about modding. See the modding overview for an abstract on modding.
This page is about modding. See the modding overview for an abstract on modding.

Mods can add custom key mapping entries to the Key Mapping menu.

Key Mapping.png

Players can then bind a key to the mod's custom command.

When the player presses that key, the mod's custom command is received as an event on the player character. This means that at least a small amount of C# scripting is required to take advantage of the key mapping infrastructure.

Define Key Mapping Options

A mod defines its custom key mapping options in a Commands.xml file. Here's an example file that defines two commands.

<?xml version="1.0" encoding="utf-8"?>
<commands>
  <command ID="ModName_Cmd_One" DisplayText="My Custom Debug Command" Category="Debug"></command>
  <command ID="ModName_Cmd_Two" DisplayText="My Custom Cool Command" Category="Cool"></command>
</commands>

In this case, we've added one command to the existing "Debug" category in the Key Mapping menu. We've added another command to a new category - the "Cool" category. Here's how it looks in game:

Modding - Custom Key Mapping Menu.png