https://github.com/rm-code/pz-keyinjector
A small modding utility that allows the addition of custom keys to Project Zomboid.
https://github.com/rm-code/pz-keyinjector
Last synced: 3 months ago
JSON representation
A small modding utility that allows the addition of custom keys to Project Zomboid.
- Host: GitHub
- URL: https://github.com/rm-code/pz-keyinjector
- Owner: rm-code
- License: unlicense
- Created: 2015-06-28T17:50:03.000Z (almost 10 years ago)
- Default Branch: develop
- Last Pushed: 2015-07-27T08:21:53.000Z (almost 10 years ago)
- Last Synced: 2025-01-27T12:48:07.601Z (5 months ago)
- Language: Lua
- Size: 328 KB
- Stars: 2
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Project Zomboid Key Injector
An example of how to add custom keybindings to [Project Zomboid](http://projectzomboid.com/).

## Usage Instructions
To add custom keys for your own mod you will need to modify the constants _CUSTOM_SECTION_ and _CUSTOM_KEYS_ in [_KeyInjector.lua_](https://raw.githubusercontent.com/rm-code/pz-keyinjector/develop/media/lua/client/KeyInjector.lua):
```
-- The custom section which will be used as a separator in the options.
local CUSTOM_SECTION = 'RMTESTMOD';-- The keys we want to register at the beginning of the game.
local CUSTOM_KEYS = {
{ value = 'TOGGLE_STUFF', key = 24 },
{ value = 'TOGGLE_OTHER', key = 25 },
-- Add more keys here
}```
These need to correspond with the entries in your translation files:
```
UI_DE = {
UI_optionscreen_binding_RMTESTMOD = "Custom Mod",
UI_optionscreen_binding_TOGGLE_STUFF = "Toggle some functionality",
UI_optionscreen_binding_TOGGLE_OTHER = "Toggle other functionality",
};```
To avoid conflicts with other mods you should try to choose unique identifiers for your translation files / strings.
If you need a "real-world" example, check out the [Better Shouts](https://github.com/rm-code/Better-Shouts) mod, which adds a custom key code for shouting.