Difference between revisions of "Modding:Player Guide/Key Bindings"

From Stardew Valley Wiki
Jump to navigation Jump to search
(add category)
 
(43 intermediate revisions by 10 users not shown)
Line 1: Line 1:
←[[Modding:Index|Index]]
+
{{modding player guide header}}
  
Some mods let you edit key bindings. This page explains how to configure them.
+
Some mods let you edit key bindings, which are controller/keyboard/mouse buttons which do something in-game. This page explains how to configure them. (This works for any mod using SMAPI's standard APIs.)
  
==How to configure a mod's bindings==
+
==How to…==
# Install the mod ([[Modding:Player FAQs#Add or remove mods|see help]]).
+
===Configure a mod's bindings===
 +
# Install the mod ([[Modding:Player Guide/Getting Started|see player guide]]).
 
# Run SMAPI at least once with the mod to let it generate its config file.
 
# Run SMAPI at least once with the mod to let it generate its config file.
# Edit <tt>config.json</tt> in the mod's folder with a text editor.
+
# Edit <samp>config.json</samp> in the mod's folder with a text editor.
# Find the key you want to change, and see the lookup below.
+
# Change the key options using [[#Button codes|the values below]]. (On macOS, make sure it doesn't change to curly quotes.)
  
 
Note that some mods may not be configurable.
 
Note that some mods may not be configurable.
  
==Available bindings==
+
===Disable a mod's key binding===
 +
You can use <samp>"None"</samp> to disable a key binding.
 +
 
 +
===Find the code for a key===
 +
[[#Button codes|''Button codes'']] below shows all available codes, but sometimes it's not clear which one applies (''e.g.,'' for non-English keyboards). Here's how to check:
 +
 
 +
# Launch the game.
 +
# In the SMAPI console window, enter the <samp>test_input</samp> command.
 +
# In the game, press the keys you want to test.
 +
# The SMAPI console will list the codes for the keys it received.
 +
 
 +
===Use key bindings on Android===
 +
You can [[#Mobile|bind physical mobile buttons]], but there aren't many available. [[Modding:Installing SMAPI on Android|SMAPI on Android]] includes a Virtual Keyboard mod which lets you add on-screen buttons you can tap to send keyboard input to your installed mods.
 +
 
 +
To use the virtual keyboard:
 +
# In-game, a keyboard icon should appear in the top-left corner of the screen.
 +
# Tap the keyboard icon to show the configured buttons.
 +
# Tap the button to send.
 +
 
 +
To add a new key:
 +
# Run the game once to generate the default <samp>config.json</samp> file.
 +
# Open the <samp>Mods/VirtualKeyboard/config.json</samp> file in a text editor.
 +
# Add new buttons to the <samp>buttons</samp> field in the same format.<br />''Tip: when you add a button, set its <samp>X</samp> value to the previous button + 96.''
 +
 
 +
==Button codes==
 
===Keyboard===
 
===Keyboard===
Keyboard bindings are supported by virtually all configurable mods.
 
 
 
; common keys
 
; common keys
 
: {| class="wikitable"
 
: {| class="wikitable"
Line 21: Line 44:
 
! description
 
! description
 
|-
 
|-
| <tt>A</tt> through <tt>Z</tt>
+
| <samp>A</samp> through <samp>Z</samp>
 
| The letter keys.
 
| The letter keys.
 
|-
 
|-
| <tt>D0</tt> through <tt>D9</tt>
+
| <samp>D0</samp> through <samp>D9</samp>
 
| The number keys.
 
| The number keys.
 
|-
 
|-
| <tt>Down</tt>, <tt>Left</tt>,<br /><tt>Right</tt>, <tt>Up</tt>
+
| <samp>Down</samp>, <samp>Left</samp>,<br /><samp>Right</samp>, <samp>Up</samp>
 
| The arrow keys.
 
| The arrow keys.
 
|-
 
|-
| <tt>F1</tt> through <tt>F24</tt>
+
| <samp>F1</samp> through <samp>F24</samp>
 
| The function keys.
 
| The function keys.
 
|-
 
|-
| <tt>Apps</tt>
+
| <samp>Apps</samp>
 
| The applications or menu ({{key|▤}}) key, typically located next to your right {{key|CTRL}} key.
 
| The applications or menu ({{key|▤}}) key, typically located next to your right {{key|CTRL}} key.
 
|-
 
|-
| <tt>Backspace</tt>
+
| <samp>Back</samp>
 
| The backspace ({{key|⌫}} or {{key|⟵}}) key.
 
| The backspace ({{key|⌫}} or {{key|⟵}}) key.
 
|-
 
|-
| <tt>CapsLock</tt>
+
| <samp>CapsLock</samp>
 
| The {{key|CAPS LOCK}} or {{key|⇪}} key.
 
| The {{key|CAPS LOCK}} or {{key|⇪}} key.
 
|-
 
|-
| <tt>Enter</tt>
+
| <samp>Enter</samp>
 
| The {{key|ENTER}} or {{key|↵}} key.
 
| The {{key|ENTER}} or {{key|↵}} key.
 
|-
 
|-
| <tt>Escape</tt>
+
| <samp>Escape</samp>
 
| The {{key|ESC}} key.
 
| The {{key|ESC}} key.
 
|-
 
|-
| <tt>LeftAlt</tt>, <tt>RightAlt</tt>
+
| <samp>LeftAlt</samp>, <samp>RightAlt</samp>
 
| The {{key|ALT}} keys.
 
| The {{key|ALT}} keys.
 
|-
 
|-
| <tt>LeftControl</tt>, <tt>RightControl</tt>
+
| <samp>LeftControl</samp>, <samp>RightControl</samp>
| The {{key|CTRL}} key.
+
| The {{key|CTRL}} keys.
 
|-
 
|-
| <tt>LeftShift</tt>, <tt>RightShift</tt>
+
| <samp>LeftShift</samp>, <samp>RightShift</samp>
 
| The {{key|SHIFT}} or {{key|⇧}} keys.
 
| The {{key|SHIFT}} or {{key|⇧}} keys.
 
|-
 
|-
| <tt>LeftWindows</tt>, <tt>RightWindows</tt>
+
| <samp>LeftWindows</samp>, <samp>RightWindows</samp>
 
| The Windows keys.
 
| The Windows keys.
 
|-
 
|-
| <tt>OemCloseBrackets</tt>
+
| <samp>OemCloseBrackets</samp>
 
| The {{key|]}} key.
 
| The {{key|]}} key.
 
|-
 
|-
| <tt>OemComma</tt>
+
| <samp>OemComma</samp>
 
| The {{key|,}} key.
 
| The {{key|,}} key.
 
|-
 
|-
| <tt>OemMinus</tt>
+
| <samp>OemMinus</samp>
 
| The {{key|-}} key.
 
| The {{key|-}} key.
 
|-
 
|-
| <tt>OemOpenBrackets</tt>
+
| <samp>OemOpenBrackets</samp>
 
| The {{key|[}} key.
 
| The {{key|[}} key.
 
|-
 
|-
| <tt>OemPeriod</tt>
+
| <samp>OemPeriod</samp>
 
| The {{key|.}} key.
 
| The {{key|.}} key.
 
|-
 
|-
| <tt>OemPipe</tt>
+
| <samp>OemPipe</samp>
 
| The {{key|&#124;}} key.
 
| The {{key|&#124;}} key.
 
|-
 
|-
| <tt>OemPlus</tt>
+
| <samp>OemPlus</samp>
 
| The {{key|+}} key.
 
| The {{key|+}} key.
 
|-
 
|-
| <tt>OemQuestion</tt>
+
| <samp>OemQuestion</samp>
 
| The {{key|?}} key on a US standard keyboard.
 
| The {{key|?}} key on a US standard keyboard.
 
|-
 
|-
| <tt>OemQuotes</tt>
+
| <samp>OemQuotes</samp>
 
| The {{key|'}} or {{key|"}} key on a US standard keyboard.
 
| The {{key|'}} or {{key|"}} key on a US standard keyboard.
 
|-
 
|-
| <tt>OemSemicolon</tt>
+
| <samp>OemSemicolon</samp>
 
| The {{key|;}} key on a US standard keyboard.
 
| The {{key|;}} key on a US standard keyboard.
 
|-
 
|-
| <tt>OemTilde</tt>
+
| <samp>OemTilde</samp>
 
| The {{key|~}} key on a US standard keyboard.
 
| The {{key|~}} key on a US standard keyboard.
 
|-
 
|-
| <tt>Space</tt>
+
| <samp>Space</samp>
 
| The space bar.
 
| The space bar.
 
|-
 
|-
| <tt>Tab</tt>
+
| <samp>Tab</samp>
| The {{key|TAB}} or {{key|
+
| The {{key|TAB}} key.
Subtract Subtract key
 
Tab TAB key
 
 
 
 
|}
 
|}
  
Line 109: Line 129:
 
! description
 
! description
 
|-
 
|-
| <tt>Numpad0</tt> through <tt>Numpad9</tt>
+
| <samp>Numpad0</samp> through <samp>Numpad9</samp>
 
| The numpad number keys.
 
| The numpad number keys.
 
|-
 
|-
| <tt>Add</tt>
+
| <samp>Add</samp>
 
| The {{key|+}} numpad key.
 
| The {{key|+}} numpad key.
 
|-
 
|-
| <tt>Divide</tt>
+
| <samp>Subtract</samp>
 +
| The {{key|-}} numpad key.
 +
|-
 +
| <samp>Divide</samp>
 
| The {{key|/}} numpad key.
 
| The {{key|/}} numpad key.
 
|-
 
|-
| <tt>Multiply</tt>
+
| <samp>Multiply</samp>
 
| The {{key|*}} numpad key.
 
| The {{key|*}} numpad key.
 
|-
 
|-
| <tt>NumLock</tt>
+
| <samp>NumLock</samp>
 
| The numeric lock, {{key|NUMLOCK}}, {{key|NUMLK}}, or {{key|NUM}} key.
 
| The numeric lock, {{key|NUMLOCK}}, {{key|NUMLK}}, or {{key|NUM}} key.
 
|}
 
|}
Line 131: Line 154:
 
! description
 
! description
 
|-
 
|-
| <tt>Delete</tt>
+
| <samp>Delete</samp>
 
| The {{key|DEL}} key.
 
| The {{key|DEL}} key.
 
|-
 
|-
| <tt>End</tt>
+
| <samp>End</samp>
 
| The {{key|END}} key.
 
| The {{key|END}} key.
 
|-
 
|-
| <tt>Insert</tt>
+
| <samp>Insert</samp>
 
| The {{key|INS}} key.
 
| The {{key|INS}} key.
 
|-
 
|-
| <tt>PageDown</tt>, <tt>PageUp</tt>
+
| <samp>PageDown</samp>, <samp>PageUp</samp>
 
| The {{key|PAGE UP}} and {{key|PAGE DOWN}} keys.
 
| The {{key|PAGE UP}} and {{key|PAGE DOWN}} keys.
 
|-
 
|-
| <tt>Pause</tt>
+
| <samp>Pause</samp>
 
| The {{key|PAUSE}} key.
 
| The {{key|PAUSE}} key.
 
|-
 
|-
| <tt>PrintScreen</tt>
+
| <samp>PrintScreen</samp>
 
| The {{key|PRT SCR}} key.
 
| The {{key|PRT SCR}} key.
 
|-
 
|-
| <tt>Scroll</tt>
+
| <samp>Scroll</samp>
 
| The {{key|SCR LK}} key.
 
| The {{key|SCR LK}} key.
 
|}
 
|}
Line 161: Line 184:
 
! description
 
! description
 
|-
 
|-
| <tt>BrowserBack</tt>
+
| <samp>BrowserBack</samp>
 
| The browser back key.
 
| The browser back key.
 
|-
 
|-
| <tt>BrowserFavorites</tt>
+
| <samp>BrowserFavorites</samp>
 
| The browser favorites key.
 
| The browser favorites key.
 
|-
 
|-
| <tt>BrowserForward</tt>
+
| <samp>BrowserForward</samp>
 
| The browser forward key.
 
| The browser forward key.
 
|-
 
|-
| <tt>BrowserHome</tt>
+
| <samp>BrowserHome</samp>
 
| The browser start and home key.
 
| The browser start and home key.
 
|-
 
|-
| <tt>BrowserRefresh</tt>
+
| <samp>BrowserRefresh</samp>
 
| The browser refresh key.
 
| The browser refresh key.
 
|-
 
|-
| <tt>BrowserSearch</tt>
+
| <samp>BrowserSearch</samp>
 
| The browser search key.
 
| The browser search key.
 
|-
 
|-
| <tt>BrowserStop</tt>
+
| <samp>BrowserStop</samp>
 
| The browser stop key.
 
| The browser stop key.
 
|-
 
|-
| <tt>ChatPadGreen</tt>
+
| <samp>ChatPadGreen</samp>
 
| The green ChatPad key.
 
| The green ChatPad key.
 
|-
 
|-
| <tt>ChatPadOrange</tt>
+
| <samp>ChatPadOrange</samp>
 
| The orange ChatPad key.
 
| The orange ChatPad key.
 
|-
 
|-
| <tt>Crsel</tt>
+
| <samp>Crsel</samp>
 
| The cursor select key.
 
| The cursor select key.
 
|-
 
|-
| <tt>Decimal</tt>
+
| <samp>Decimal</samp>
 
| The decimal key.
 
| The decimal key.
 
|-
 
|-
| <tt>EraseEof</tt>
+
| <samp>EraseEof</samp>
 
| The erase EOF key.
 
| The erase EOF key.
 
|-
 
|-
| <tt>Execute</tt>
+
| <samp>Execute</samp>
 
| The execute key.
 
| The execute key.
 
|-
 
|-
| <tt>Exsel</tt>
+
| <samp>Exsel</samp>
 
| The execute selection key.
 
| The execute selection key.
 
|-
 
|-
| <tt>Help</tt>
+
| <samp>Help</samp>
 
| The help key.
 
| The help key.
 
|-
 
|-
| <tt>Home</tt>
+
| <samp>Home</samp>
 
| The home key.
 
| The home key.
 
|-
 
|-
| <tt>ImeConvert</tt>
+
| <samp>ImeConvert</samp>
 
| The IME convert key.
 
| The IME convert key.
 
|-
 
|-
| <tt>ImeNoConvert</tt>
+
| <samp>ImeNoConvert</samp>
 
| The IME no-convert key.
 
| The IME no-convert key.
 
|-
 
|-
| <tt>Kana</tt>
+
| <samp>Kana</samp>
 
| The Kana key on Japanese keyboards.
 
| The Kana key on Japanese keyboards.
 
|-
 
|-
| <tt>Kanji</tt>
+
| <samp>Kanji</samp>
 
| The Kanji key on Japanese keyboards.
 
| The Kanji key on Japanese keyboards.
 
|-
 
|-
| <tt>LaunchApplication1</tt>
+
| <samp>LaunchApplication1</samp>
 
| The Start Application 1 key.
 
| The Start Application 1 key.
 
|-
 
|-
| <tt>LaunchApplication2</tt>
+
| <samp>LaunchApplication2</samp>
 
| The Start Application 2 key.
 
| The Start Application 2 key.
 
|-  
 
|-  
| <tt>LaunchMail</tt>
+
| <samp>LaunchMail</samp>
 
| The Start Mail key.
 
| The Start Mail key.
 
|-
 
|-
| <tt>MediaNextTrack</tt>
+
| <samp>MediaNextTrack</samp>
 
| The Next Track key.
 
| The Next Track key.
 
|-
 
|-
| <tt>MediaPlayPause</tt>
+
| <samp>MediaPlayPause</samp>
 
| The Play/Pause Media key.
 
| The Play/Pause Media key.
 
|-
 
|-
| <tt>MediaPreviousTrack</tt>
+
| <samp>MediaPreviousTrack</samp>
 
| The Previous Track key.
 
| The Previous Track key.
 
|-
 
|-
| <tt>MediaStop</tt>
+
| <samp>MediaStop</samp>
 
| The Stop Media key.
 
| The Stop Media key.
 
|-
 
|-
| <tt>Oem8</tt>
+
| <samp>Oem8</samp>
 
| Varies by keyboard.
 
| Varies by keyboard.
 
|-
 
|-
| <tt>OemAuto</tt>
+
| <samp>OemAuto</samp>
 
| OEM Auto key.
 
| OEM Auto key.
 
|-
 
|-
| <tt>OemBackslash</tt>
+
| <samp>OemBackslash</samp>
 
| The The OEM angle bracket or backslash key on the RT 102 key keyboard.
 
| The The OEM angle bracket or backslash key on the RT 102 key keyboard.
 
|-
 
|-
| <tt>OemClear</tt>
+
| <samp>OemClear</samp>
 
| The OEM clear key.
 
| The OEM clear key.
 
|-
 
|-
| <tt>OemCopy</tt>
+
| <samp>OemCopy</samp>
 
| The OEM copy key.
 
| The OEM copy key.
 
|-
 
|-
| <tt>OemEnlW</tt>
+
| <samp>OemEnlW</samp>
 
| The OEM Enlarge Window key.
 
| The OEM Enlarge Window key.
 
|-
 
|-
| <tt>PA1</tt>
+
| <samp>PA1</samp>
 
| The PA1 key.
 
| The PA1 key.
 
|-
 
|-
| <tt>Play</tt>
+
| <samp>Play</samp>
 
| The play key.
 
| The play key.
 
|-
 
|-
| <tt>Print</tt>
+
| <samp>Print</samp>
 
| The {{key|PRINT}} key.
 
| The {{key|PRINT}} key.
 
|-
 
|-
| <tt>ProcessKey</tt>
+
| <samp>ProcessKey</samp>
 
| The IME process key.
 
| The IME process key.
 
|-
 
|-
| <tt>Select</tt>
+
| <samp>Select</samp>
 
| The select key.
 
| The select key.
 
|-
 
|-
| <tt>SelectMedia</tt>
+
| <samp>SelectMedia</samp>
 
| The select media key.
 
| The select media key.
 
|-
 
|-
| <tt>Separator</tt>
+
| <samp>Separator</samp>
 
| The separator key.
 
| The separator key.
 
|-
 
|-
| <tt>Sleep</tt>
+
| <samp>Sleep</samp>
 
| The computer sleep key.
 
| The computer sleep key.
 
|-
 
|-
| <tt>VolumeDown</tt>, <tt>VolumeUp</tt>
+
| <samp>VolumeDown</samp>, <samp>VolumeUp</samp>
 
| The volume down/up keys.
 
| The volume down/up keys.
 
|-
 
|-
| <tt>VolumeMute</tt>
+
| <samp>VolumeMute</samp>
 
| The volume mute keys.
 
| The volume mute keys.
 
|-
 
|-
| <tt>Zoom</tt>
+
| <samp>Zoom</samp>
 
| The zoom key.
 
| The zoom key.
 
|}
 
|}
  
 
===Controller===
 
===Controller===
Controller bindings are supported by mods using SMAPI 2.0+ features, and some older mods.
 
 
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
Line 302: Line 323:
 
! description
 
! description
 
|-
 
|-
| <tt>ControllerA</tt>, <tt>ControllerB</tt>,<br /><tt>ControllerX</tt>, <tt>ControllerY</tt>
+
| <samp>ControllerA</samp>, <samp>ControllerB</samp>,<br /><samp>ControllerX</samp>, <samp>ControllerY</samp>
 
| The main buttons.
 
| The main buttons.
 
|-
 
|-
| <tt>ControllerBack</tt>
+
| <samp>ControllerBack</samp>
 
| The 'BACK' button on an XBox controller.
 
| The 'BACK' button on an XBox controller.
 
|-
 
|-
| <tt>ControllerStart</tt>
+
| <samp>ControllerStart</samp>
 
| The 'START' button.
 
| The 'START' button.
 
|-
 
|-
| <tt>BigButton</tt>
+
| <samp>BigButton</samp>
 
| The 'big button' on the XBox Big Button controller.
 
| The 'big button' on the XBox Big Button controller.
 
|-
 
|-
| <tt>DPadDown</tt>, <tt>DPadLeft</tt><br /><tt>DPadRight</tt>, <tt>DPadUp</tt>
+
| <samp>DPadDown</samp>, <samp>DPadLeft</samp><br /><samp>DPadRight</samp>, <samp>DPadUp</samp>
 
| The directional pad buttons.
 
| The directional pad buttons.
 
|-
 
|-
| <tt>LeftShoulder</tt>, <tt>RightShoulder</tt>
+
| <samp>LeftShoulder</samp>, <samp>RightShoulder</samp>
| The bumper (shoulder) buttons.
+
| The bumper (shoulder) buttons.  
 
|-
 
|-
| <tt>LeftStick</tt>, <tt>RightStick</tt>
+
| <samp>LeftTrigger</samp>, <samp>RightTrigger</samp>
| The left/right thumbsticks when pressed as a button.
+
| The trigger buttons.
 
|-
 
|-
| <tt>LeftThumbstickDown</tt>, <tt>LeftThumbstickLeft</tt>,<br /><tt>LeftThumbstickRight</tt>, <tt>LeftThumbstickUp</tt>
+
| <samp>LeftStick</samp>, <samp>RightStick</samp>
 +
| The left/right thumbsticks when clicked or pressed as a button.
 +
|-
 +
| <samp>LeftThumbstickDown</samp>, <samp>LeftThumbstickLeft</samp>,<br /><samp>LeftThumbstickRight</samp>, <samp>LeftThumbstickUp</samp>
 
| The left thumbstick when pushed in a direction.
 
| The left thumbstick when pushed in a direction.
 
|-
 
|-
| <tt>LeftTrigger</tt>, <tt>RightTrigger</tt>
+
| <samp>RightThumbstickDown</samp>, <samp>RightThumbstickLeft</samp>,<br /><samp>RightThumbstickRight</samp>, <samp>RightThumbstickUp</samp>
| The trigger buttons.
 
|-
 
| <tt>RightThumbstickDown</tt>, <tt>RightThumbstickLeft</tt>,<br /><tt>RightThumbstickRight</tt>, <tt>RightThumbstickUp</tt>
 
 
| The right thumbstick when pushed in a direction.
 
| The right thumbstick when pushed in a direction.
 
|}
 
|}
  
 
===Mouse===
 
===Mouse===
Mouse bindings are supported by mods using SMAPI 2.0+ features.
 
 
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
Line 341: Line 360:
 
! description
 
! description
 
|-
 
|-
| <tt>MouseLeft</tt>
+
| <samp>MouseLeft</samp>
 
| The left mouse button.
 
| The left mouse button.
 
|-
 
|-
| <tt>MouseRight</tt>
+
| <samp>MouseRight</samp>
 
| The right mouse button.
 
| The right mouse button.
 
|-
 
|-
| <tt>MouseMiddle</tt>
+
| <samp>MouseMiddle</samp>
 
| The middle mouse button.
 
| The middle mouse button.
 
|-
 
|-
| <tt>MouseX1</tt>, <tt>MouseX2</tt>
+
| <samp>MouseX1</samp>, <samp>MouseX2</samp>
 
| The extended mouse buttons (varies by mouse).
 
| The extended mouse buttons (varies by mouse).
 
|}
 
|}
  
==For modders==
+
===Mobile===
These constants are part of the [[Modding:SMAPI APIs#Input events|SMAPI input events]], specifically SMAPI's <tt>SButton</tt> enum which unifies XNA's [https://msdn.microsoft.com/en-us/library/microsoft.xna.framework.input.buttons.aspx <tt>Buttons</tt>], [https://msdn.microsoft.com/en-us/library/microsoft.xna.framework.input.keys.aspx <tt>Keys</tt>], and [https://msdn.microsoft.com/en-us/library/microsoft.xna.framework.input.mousestate.aspx <tt>MouseState</tt>].
+
{| class="wikitable"
 +
|-
 +
! value
 +
! description
 +
|-
 +
| <samp>VolumeUp</samp>, <samp>VolumeDown</samp>
 +
| The volume up/down buttons.
 +
|}
 +
 
 +
==Device mappings==
 +
===Steam Deck===
 +
The Steam deck is mapped as a controller (see [[#Controller|controller codes]]), and you can remap buttons using Steam Input. Here's how the different Steam Deck buttons are mapped by default:
 +
 
 +
{| class="wikitable"
 +
|-
 +
! button
 +
! mapped as
 +
|-
 +
| A, B, X, Y<br />left/right shoulder<br />left/right trigger buttons<br />left/right thumbstick<br />D-Pad<br />Start<br />Select
 +
| Sends the equivalent controller codes.
 +
|-
 +
| left touchpad
 +
| Sends equivalent D-Pad codes when touching the edges (e.g. left edge is <samp>DPadLeft</samp>).
 +
|-
 +
| right touchpad
 +
| Sends right thumbstick codes.
 +
|-
 +
| 'Back grip' buttons (L4, L5, R4, R5)
 +
| Not sent to the game by default, unless mapped to a key in Steam Input.
 +
|-
 +
| {{key|Steam}}<br />{{key|...}}
 +
| Not sent to the game.
 +
|}
 +
 
 +
You can also rebind physical keys in the Steam Deck settings:
 +
# Go to ''Controller Settings > Edit Layout''.
 +
# Choose the button to rebind.
 +
# Choose ''Command Page > Keyboard''.
 +
# Choose the keyboard button to bind it to.
 +
# Now when you press that physical button in-game, it'll send the new keyboard code instead.
 +
 
 +
==Multi-key bindings==
 +
Mods using SMAPI 3.9+ features can support multi-key bindings. That lets you combine multiple [[#Button codes|button codes]] into a combo keybind, and list alternate keybinds. For example, <code>"LeftShoulder, LeftControl + S"</code> will apply if <samp>LeftShoulder</samp> is pressed, ''or'' if both <samp>LeftControl</samp> and <samp>S</samp> are pressed.
 +
 
 +
Some things to keep in mind:
 +
* The order doesn't matter, so <code>"LeftControl + S"</code> and <code>"S + LeftControl"</code> are equivalent.
 +
* SMAPI doesn't prevent mods from using overlapping hotkeys. For example, if one mod uses <code>"S"</code> and the other mod uses <code>"LeftControl + S"</code>, pressing <samp>LeftControl</samp> and <samp>S</samp> will activate both.
 +
 
 +
==See also==
 +
* [[Controls]] for the game's default bindings
 +
* [[Modding:Modder Guide/APIs/Input|SMAPI input events]] for mod authors
  
 
[[Category:Modding]]
 
[[Category:Modding]]
 +
 +
[[de:Modding:Spieleranleitung/Tastenbelegung]]
 +
[[es:Modding:Guía del jugador/Enlaces de teclas]]
 +
[[zh:模组:使用指南/按键绑定]]

Latest revision as of 02:26, 16 April 2024

Some mods let you edit key bindings, which are controller/keyboard/mouse buttons which do something in-game. This page explains how to configure them. (This works for any mod using SMAPI's standard APIs.)

How to…

Configure a mod's bindings

  1. Install the mod (see player guide).
  2. Run SMAPI at least once with the mod to let it generate its config file.
  3. Edit config.json in the mod's folder with a text editor.
  4. Change the key options using the values below. (On macOS, make sure it doesn't change to curly quotes.)

Note that some mods may not be configurable.

Disable a mod's key binding

You can use "None" to disable a key binding.

Find the code for a key

Button codes below shows all available codes, but sometimes it's not clear which one applies (e.g., for non-English keyboards). Here's how to check:

  1. Launch the game.
  2. In the SMAPI console window, enter the test_input command.
  3. In the game, press the keys you want to test.
  4. The SMAPI console will list the codes for the keys it received.

Use key bindings on Android

You can bind physical mobile buttons, but there aren't many available. SMAPI on Android includes a Virtual Keyboard mod which lets you add on-screen buttons you can tap to send keyboard input to your installed mods.

To use the virtual keyboard:

  1. In-game, a keyboard icon should appear in the top-left corner of the screen.
  2. Tap the keyboard icon to show the configured buttons.
  3. Tap the button to send.

To add a new key:

  1. Run the game once to generate the default config.json file.
  2. Open the Mods/VirtualKeyboard/config.json file in a text editor.
  3. Add new buttons to the buttons field in the same format.
    Tip: when you add a button, set its X value to the previous button + 96.

Button codes

Keyboard

common keys
value description
A through Z The letter keys.
D0 through D9 The number keys.
Down, Left,
Right, Up
The arrow keys.
F1 through F24 The function keys.
Apps The applications or menu () key, typically located next to your right CTRL key.
Back The backspace ( or ) key.
CapsLock The CAPS LOCK or key.
Enter The ENTER or key.
Escape The ESC key.
LeftAlt, RightAlt The ALT keys.
LeftControl, RightControl The CTRL keys.
LeftShift, RightShift The SHIFT or keys.
LeftWindows, RightWindows The Windows keys.
OemCloseBrackets The ] key.
OemComma The , key.
OemMinus The - key.
OemOpenBrackets The [ key.
OemPeriod The . key.
OemPipe The | key.
OemPlus The + key.
OemQuestion The ? key on a US standard keyboard.
OemQuotes The ' or " key on a US standard keyboard.
OemSemicolon The ; key on a US standard keyboard.
OemTilde The ~ key on a US standard keyboard.
Space The space bar.
Tab The TAB key.
numeric pad
value description
Numpad0 through Numpad9 The numpad number keys.
Add The + numpad key.
Subtract The - numpad key.
Divide The / numpad key.
Multiply The * numpad key.
NumLock The numeric lock, NUMLOCK, NUMLK, or NUM key.
control keys (above arrow keys)
value description
Delete The DEL key.
End The END key.
Insert The INS key.
PageDown, PageUp The PAGE UP and PAGE DOWN keys.
Pause The PAUSE key.
PrintScreen The PRT SCR key.
Scroll The SCR LK key.
uncommon keys
value description
BrowserBack The browser back key.
BrowserFavorites The browser favorites key.
BrowserForward The browser forward key.
BrowserHome The browser start and home key.
BrowserRefresh The browser refresh key.
BrowserSearch The browser search key.
BrowserStop The browser stop key.
ChatPadGreen The green ChatPad key.
ChatPadOrange The orange ChatPad key.
Crsel The cursor select key.
Decimal The decimal key.
EraseEof The erase EOF key.
Execute The execute key.
Exsel The execute selection key.
Help The help key.
Home The home key.
ImeConvert The IME convert key.
ImeNoConvert The IME no-convert key.
Kana The Kana key on Japanese keyboards.
Kanji The Kanji key on Japanese keyboards.
LaunchApplication1 The Start Application 1 key.
LaunchApplication2 The Start Application 2 key.
LaunchMail The Start Mail key.
MediaNextTrack The Next Track key.
MediaPlayPause The Play/Pause Media key.
MediaPreviousTrack The Previous Track key.
MediaStop The Stop Media key.
Oem8 Varies by keyboard.
OemAuto OEM Auto key.
OemBackslash The The OEM angle bracket or backslash key on the RT 102 key keyboard.
OemClear The OEM clear key.
OemCopy The OEM copy key.
OemEnlW The OEM Enlarge Window key.
PA1 The PA1 key.
Play The play key.
Print The PRINT key.
ProcessKey The IME process key.
Select The select key.
SelectMedia The select media key.
Separator The separator key.
Sleep The computer sleep key.
VolumeDown, VolumeUp The volume down/up keys.
VolumeMute The volume mute keys.
Zoom The zoom key.

Controller

value description
ControllerA, ControllerB,
ControllerX, ControllerY
The main buttons.
ControllerBack The 'BACK' button on an XBox controller.
ControllerStart The 'START' button.
BigButton The 'big button' on the XBox Big Button controller.
DPadDown, DPadLeft
DPadRight, DPadUp
The directional pad buttons.
LeftShoulder, RightShoulder The bumper (shoulder) buttons.
LeftTrigger, RightTrigger The trigger buttons.
LeftStick, RightStick The left/right thumbsticks when clicked or pressed as a button.
LeftThumbstickDown, LeftThumbstickLeft,
LeftThumbstickRight, LeftThumbstickUp
The left thumbstick when pushed in a direction.
RightThumbstickDown, RightThumbstickLeft,
RightThumbstickRight, RightThumbstickUp
The right thumbstick when pushed in a direction.

Mouse

value description
MouseLeft The left mouse button.
MouseRight The right mouse button.
MouseMiddle The middle mouse button.
MouseX1, MouseX2 The extended mouse buttons (varies by mouse).

Mobile

value description
VolumeUp, VolumeDown The volume up/down buttons.

Device mappings

Steam Deck

The Steam deck is mapped as a controller (see controller codes), and you can remap buttons using Steam Input. Here's how the different Steam Deck buttons are mapped by default:

button mapped as
A, B, X, Y
left/right shoulder
left/right trigger buttons
left/right thumbstick
D-Pad
Start
Select
Sends the equivalent controller codes.
left touchpad Sends equivalent D-Pad codes when touching the edges (e.g. left edge is DPadLeft).
right touchpad Sends right thumbstick codes.
'Back grip' buttons (L4, L5, R4, R5) Not sent to the game by default, unless mapped to a key in Steam Input.
Steam
...
Not sent to the game.

You can also rebind physical keys in the Steam Deck settings:

  1. Go to Controller Settings > Edit Layout.
  2. Choose the button to rebind.
  3. Choose Command Page > Keyboard.
  4. Choose the keyboard button to bind it to.
  5. Now when you press that physical button in-game, it'll send the new keyboard code instead.

Multi-key bindings

Mods using SMAPI 3.9+ features can support multi-key bindings. That lets you combine multiple button codes into a combo keybind, and list alternate keybinds. For example, "LeftShoulder, LeftControl + S" will apply if LeftShoulder is pressed, or if both LeftControl and S are pressed.

Some things to keep in mind:

  • The order doesn't matter, so "LeftControl + S" and "S + LeftControl" are equivalent.
  • SMAPI doesn't prevent mods from using overlapping hotkeys. For example, if one mod uses "S" and the other mod uses "LeftControl + S", pressing LeftControl and S will activate both.

See also