Notice HOWTO: Keybinding

Discussion in 'Starbound FAQs, Q&A, and General Help' started by OmnipotentEntity, Feb 18, 2014.

  1. OmnipotentEntity

    OmnipotentEntity Code Monkey Forum Administrator

    NOTE: THE FOLLOWING POST IS OF HISTORICAL INTEREST ONLY, THE TECHNIQUES DESCRIBED HEREIN NO LONGER WORK AS OF JAN 2015.


    Some of you may have noticed that the patch notes for this version includes the purported ability to reassign key bindings, which was a feature that was in rather hot demand.

    So you fire up the game and go to options and nothing's changed. What gives?

    Well, this is a first pass on keybindings, and it doesn't have things like "gui interface" or "general userfriendliness" or "instructions"

    I'm about to fix that last part some small part.

    First, go to your game executable directory. You can get here by opening steam -> right-clicking Starbound in your library -> Properties -> Local Files Tab -> Browse Local Files

    If you've been playing this game at all, there should be a file called starbound.config.

    Open this file in Wordpad on Windows (not notepad, it'll look formatting screwed up) or any editor on any other platform. (Any editor that recognizes unix style line endings will do.) And find the entry that says and looks like:


    Code:
      "keyBindings" : {
      "A" : [ "PlayerLeft", "CockpitLeft" ],
      "Backquote" : [ "InterfaceBarNPos" ],
      "C" : [ "InterfaceCrafting" ],
      "D" : [ "PlayerRight", "CockpitRight" ],
      "Down" : [ "EmoteSad", "CockpitDown", "ChatNextLine" ],
      "E" : [ "PlayerInteract", "GuiClose" ],
      "Eight" : [ "InterfaceBar8" ],
      "Escape" : [ "TitleBack", "CinematicSkip", "InterfaceEscapeMenu", "GuiClose", "ChatStop" ],
      "F" : [ "PlayerTechAction1" ],
      "F1" : [ "InterfaceHideHud" ],
      "F11" : [ "InterfaceToggleFullscreen" ],
      "F6" : [ "InterfaceStreaming" ],
      "Five" : [ "InterfaceBar5" ],
      "Four" : [ "InterfaceBar4" ],
      "G" : [ "PlayerTechAction2" ],
      "H" : [ "PlayerTechAction3" ],
      "I" : [ "InterfaceInventory" ],
      "J" : [ "InterfaceQuest" ],
      "L" : [ "InterfaceCodex" ],
      "LAlt" : [ "ShowLabels" ],
      "LCtrl" : [ "CameraShift" ],
      "LShift" : [ "PlayerShifting", "GuiShifting" ],
      "Left" : [ "EmoteNeutral", "CockpitLeft" ],
      "Minus" : [ "InterfaceBarNPos" ],
      "N" : [ "InterfaceInspectCursor" ],
      "Nine" : [ "InterfaceBar9" ],
      "One" : [ "InterfaceBar1" ],
      "PageDown" : [ "ChatPageDown" ],
      "PageUp" : [ "ChatPageUp" ],
      "Q" : [ "PlayerDropItem" ],
      "RAlt" : [ "ShowLabels" ],
      "RCtrl" : [ "CameraShift" ],
      "RShift" : [ "PlayerShifting", "GuiShifting" ],
      "Return" : [ "CinematicNext", "ChatSendLine", "ChatBegin" ],
      "Right" : [ "EmoteAnnoyed", "CockpitRight", "CinematicNext" ],
      "S" : [ "PlayerDown", "CockpitDown" ],
      "Seven" : [ "InterfaceBar7" ],
      "Six" : [ "InterfaceBar6" ],
      "Slash" : [ "ChatBeginCommand" ],
      "Space" : [ "PlayerJump" ],
      "Three" : [ "InterfaceBar3" ],
      "Two" : [ "InterfaceBar2" ],
      "Up" : [ "EmoteHappy", "CockpitUp", "ChatPreviousLine" ],
      "W" : [ "PlayerUp", "CockpitUp" ],
      "X" : [ "InterfaceDeselectHands" ],
      "Y" : [ "InterfaceRepeatCommand" ],
      "Z" : [ "InterfaceSwapHands" ],
      "Zero" : [ "InterfaceBar0" ]
      },
    This is a list of keys and then a list of actions. When you press the "2" key on your keyboard (not numpad) the "InterfaceBar2" action is sent.

    All you have to do is change which key the associated action will perform. For instance, if you want to change the key that drops your held item to the backslash key because get it out of my face I don't NEED you, you would remove the change

    "Q" : [ "PlayerDropItem" ],

    to

    "Backslash" : [ "PlayerDropItem" ],

    Or you can remove it altogether by simply deleting the line.

    The possible keys are:

    Code:
    enum class StarKey {
      None = 0,
      Backspace = 8,
      Tab = 9,
      Clear = 12,
      Return = 13,
      Pause = 19,
      Escape = 27,
      Space = 32,
      Exclaim = 33,
      QuotedBL = 34,
      Hash = 35,
      Dollar = 36,
      Ampersand = 38,
      Quote = 39,
      LeftParen = 40,
      RightParen = 41,
      Asterisk = 42,
      Plus = 43,
      Comma = 44,
      Minus = 45,
      Period = 46,
      Slash = 47,
      Zero = 48,
      One = 49,
      Two = 50,
      Three = 51,
      Four = 52,
      Five = 53,
      Six = 54,
      Seven = 55,
      Eight = 56,
      Nine = 57,
      Colon = 58,
      Semicolon = 59,
      Less = 60,
      Equals = 61,
      Greater = 62,
      Question = 63,
      At  = 64,
      LeftBracket = 91,
      Backslash = 92,
      RightBracket = 93,
      Caret = 94,
      Underscore = 95,
      Backquote = 96,
      A = 97,
      B = 98,
      C = 99,
      D = 100,
      E = 101,
      F = 102,
      G = 103,
      H = 104,
      I = 105,
      J = 106,
      K = 107,
      L = 108,
      M = 109,
      N = 110,
      O = 111,
      P = 112,
      Q = 113,
      R = 114,
      S = 115,
      T = 116,
      U = 117,
      V = 118,
      W = 119,
      X = 120,
      Y = 121,
      Z = 122,
      Delete = 127,
      Kp0 = 256,
      Kp1 = 257,
      Kp2 = 258,
      Kp3 = 259,
      Kp4 = 260,
      Kp5 = 261,
      Kp6 = 262,
      Kp7 = 263,
      Kp8 = 264,
      Kp9 = 265,
      Kp_period = 266,
      Kp_divide = 267,
      Kp_multiply = 268,
      Kp_minus = 269,
      Kp_plus = 270,
      Kp_enter = 271,
      Kp_equals = 272,
      Up = 273,
      Down = 274,
      Right = 275,
      Left = 276,
      Insert = 277,
      Home = 278,
      End = 279,
      PageUp = 280,
      PageDown = 281,
      F1 = 282,
      F2 = 283,
      F3 = 284,
      F4 = 285,
      F5 = 286,
      F6 = 287,
      F7 = 288,
      F8 = 289,
      F9 = 290,
      F10 = 291,
      F11 = 292,
      F12 = 293,
      F13 = 294,
      F14 = 295,
      F15 = 296,
      Numlock = 300,
      Capslock = 301,
      Scrollock = 302,
      RShift = 303,
      LShift = 304,
      RCtrl = 305,
      LCtrl = 306,
      RAlt = 307,
      LAlt = 308,
      RMeta = 309,
      LMeta = 310,
      LSuper = 311,  /* Left "Windows" key */
      RSuper = 312,  /* Right "Windows" key */
      Mode = 313,  /* "Alt Gr" key */
      Compose = 314,  /* Multi-key compose key */
      Help = 315,
      Print = 316,
      SysReq = 317,
      Break = 318,
      Menu = 319,
      Power = 320,  /* Power Macintosh power key */
      Euro = 321,  /* Some european keyboards */
      Undo = 322  /* Atari keyboard has Undo */
    };
    And the possible Actions are:

    Code:
    enum class KeyAction {
      None,
      PlayerUp,
      PlayerDown,
      PlayerLeft,
      PlayerRight,
      PlayerJump,
      PlayerDropItem,
      PlayerInteract,
      PlayerShifting,
      PlayerTechAction1,
      PlayerTechAction2,
      PlayerTechAction3,
      EmoteBlabbering,
      EmoteShouting,
      EmoteHappy,
      EmoteSad,
      EmoteNeutral,
      EmoteLaugh,
      EmoteAnnoyed,
      EmoteOh,
      EmoteOooh,
      EmoteBlink,
      EmoteWink,
      EmoteEat,
      EmoteSleep,
      ShowLabels,
      CameraShift,
      CockpitUp,
      CockpitDown,
      CockpitLeft,
      CockpitRight,
      TitleBack,
      CinematicSkip,
      CinematicNext,
      GuiClose,
      GuiShifting,
      ChatPageUp,
      ChatPageDown,
      ChatPreviousLine,
      ChatNextLine,
      ChatSendLine,
      ChatBegin,
      ChatBeginCommand,
      ChatStop,
      InterfaceHideHud,
      InterfaceSwapHands,
      InterfaceDeselectHands,
      InterfaceBar1,
      InterfaceBar2,
      InterfaceBar3,
      InterfaceBar4,
      InterfaceBar5,
      InterfaceBar6,
      InterfaceBar7,
      InterfaceBar8,
      InterfaceBar9,
      InterfaceBar0,
      InterfaceBarNPos,
      InterfaceRepeatCommand,
      InterfaceToggleFullscreen,
      InterfaceEscapeMenu,
      InterfaceStreaming,
      InterfaceInventory,
      InterfaceCodex,
      InterfaceQuest,
      InterfaceCrafting,
      InterfaceInspectCursor,
    };
     
    Last edited: Feb 2, 2015
  2. Jman1177

    Jman1177 Void-Bound Voyager

    Thanks for posting this! :D
     
  3. ghosttie

    ghosttie Void-Bound Voyager

    Can we get a key binding for warping up to the ship?
     
  4. Zephiron

    Zephiron Pangalactic Porcupine

    Thanks for the tip, Searched all files but found nothing like these till I erased the previous .cfg and reloaded.

    Are multi-buttons mouse bindings possible yet ?
     
    gelini89, atlana and NiSiSuiinegEht like this.
  5. JY454

    JY454 Yeah, You!

    Thanks for the info :)

    I may have some question about non ASCII char keyboard key (here on Gentoo Linux OS)

    On Fr Keyboard, 1 2 3 [...] 0 keys are & é " [...] à

    I have these results testing the keycode with xev when i press these keys :
    Code:
      state 0x10, keycode 10 (keysym 0x26, ampersand), same_screen YES,
      state 0x10, keycode 11 (keysym 0xe9, eacute), same_screen YES,
      state 0x10, keycode 12 (keysym 0x22, quotedbl), same_screen YES,
      state 0x10, keycode 13 (keysym 0x27, apostrophe), same_screen YES,
      state 0x10, keycode 14 (keysym 0x28, parenleft), same_screen YES,
      state 0x10, keycode 15 (keysym 0x2d, minus), same_screen YES,
      state 0x10, keycode 16 (keysym 0xe8, egrave), same_screen YES,
      state 0x10, keycode 17 (keysym 0x5f, underscore), same_screen YES,
      state 0x10, keycode 18 (keysym 0xe7, ccedilla), same_screen YES,
      state 0x10, keycode 19 (keysym 0xe0, agrave), same_screen YES,
      state 0x10, keycode 20 (keysym 0x29, parenright), same_screen YES,
      state 0x10, keycode 21 (keysym 0x3d, equal), same_screen YES,
    
    As you can see the keysym in hex matches what your StarKey enum is defining, but there are a few non ASCII char for what should be the action bar. Does it seems feasible to include international keyboard in your keybind configuration mechanism ?

    Thanks,
     
    bleedingface likes this.
  6. Sukinidachi

    Sukinidachi Big Damn Hero

    Anyone know what PlayerTechAction is? My initial thought was a button to quick change your Techs, but when I went to try the buttons, they didn't work.
    Plus, the Mech uses F.. So yeah..
     
  7. OmnipotentEntity

    OmnipotentEntity Code Monkey Forum Administrator

    I would be happy to. I would also appreciate it if someone directed me towards a good collections of international keycodes that I can add.
     
    Xech likes this.
  8. OmnipotentEntity

    OmnipotentEntity Code Monkey Forum Administrator

    PlayerTechAction1 2 and 3 perform the tech action associated with the tech. It's just a way for techs to accept input at the moment, because techs can't define their own keys or reuse ones.

    F is the Mech key because F is PlayerTechAction1.
     
    Xech and The | Suit like this.
  9. JY454

    JY454 Yeah, You!

    unfortunately it seems that for non ASCII characters, things changes according to layout/locale

    SDL seems to use generic SDLK_WORLD_[0-9]+ for these case in /usr/include/SDL/SDL_keysym.h

    To map these keysym to a value that makes sense to the user, you probably need to get the unicode field from http://www.libsdl.org/release/SDL-1.2.15/docs/html/sdlkeysym.html
     
  10. OmnipotentEntity

    OmnipotentEntity Code Monkey Forum Administrator

    Flimflam. Well, I'll make it work somehow. Thanks! :D
     
    Solum likes this.
  11. DataSchmuck

    DataSchmuck Void-Bound Voyager

    Damn, I was really hoping for mouse button binding as well. I have 3 extra buttons on my mouse that would love to be bound to some actions.
     
    gelini89, AngryBogle and Skunkie like this.
  12. SiriusBidness

    SiriusBidness Space Spelunker

    Thanks for this...

    That "Q" bind caused me some serious grief. :(
     
  13. radi0n

    radi0n Subatomic Cosmonaut

    Are multi-buttons mouse bindings possible yet ?
     
    AngryBogle likes this.
  14. KoldWing

    KoldWing Tentacle Wrangler

    wheres the control update. why did you skip that.
     
  15. the_freakish

    the_freakish 2.7182818284590...

    As for multi-mouse buttons, I recommend getting a tool that allows you to bind keys to the mouse buttons. Then you set these keys in Starbound.

    Logitech for example has an official tool to do this and it works like a charm, been using it for quite some time. You can set all your mouse buttons like this, not only the few that games may recognize
     
    Michelle911 and TheMilkableDuck like this.
  16. OmnipotentEntity

    OmnipotentEntity Code Monkey Forum Administrator

    Not quite yet. We still have some abstraction to do to make that feasible. But it's planned.
     
    gelini89, Xech and AngryBogle like this.
  17. Drybonz

    Drybonz Subatomic Cosmonaut

    When I open the config file there is nothing at all about key binding.
     
  18. dragonshadow32

    dragonshadow32 Subatomic Cosmonaut

    same here, and that config file look like options, where we edit zoom, full-screen true/false, etc. but none of these keys.
     
  19. OmnipotentEntity

    OmnipotentEntity Code Monkey Forum Administrator

    If you do not have keyBindings in your starbound.config, this simply means that for whatever reason the keybindings aren't being added to your starbound.config file.

    Back up your starbound.config file, remove it from the directory, then allow your game to auto-regenerate it, it should have keybinding information within.

    Alternately, you can use the version that I pasted in OP. That's the default configuration.
     
  20. Ramones_fan

    Ramones_fan Pangalactic Porcupine

    Please let us set a warp to/from ship keybinding, also a way to warp to your own ship from another's ship w/o having to warp to a planet.

    Thanks in advance.
     
    LizardLord and TheBengineer like this.

Share This Page