Notice HOWTO: Keybinding (Mk 2)

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

  1. OmnipotentEntity

    OmnipotentEntity Code Monkey Forum Administrator

    Just use the GUI, it's accessible from the options menu.

    In case you want to do something weird that the gui doesn't support (such as bind to Del or Esc, or rebind normally unrebindable keys) here is how you go about it.

    1. Run starbound to generate a starbound.config file (if you haven't yet already).
    2. Open the starbound.config file and find the key named "bindings"

    "bindings"

    Code:
    "actionName" : [
      {
        "mods" : [ ],
        "type" : "key",
        "value" : "1"
      },
      {
        "mods" : ["LCtrl", "LAlt"],
        "type" : "mouse",
        "value" : "Middle"
      }
    ]
    As you can see "actionName" is a list and it can take multiple keybinding configurations. The max is 2, but that limit is a soft, GUI only, checked only on assign, and may be overridden via modding the value located at "/interface/windowconfig/keybindingsmenu.config:maxKeybindings"

    "actionName" is the name of a keybinding action, and they are found in this list:

    Code:
    enum class KeyAction {
      None,
      PlayerUp,
      PlayerDown,
      PlayerLeft,
      PlayerRight,
      PlayerJump,
      PlayerMainItem,
      PlayerAltItem,
      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,
      KeybindingClear,
      KeybindingCancel,
      ChatPageUp,
      ChatPageDown,
      ChatPreviousLine,
      ChatNextLine,
      ChatSendLine,
      ChatBegin,
      ChatBeginCommand,
      ChatStop,
      InterfaceShowHelp,
      InterfaceHideHud,
      InterfaceSwapHands,
      InterfaceDeselectHands,
      InterfaceBar1,
      InterfaceBar2,
      InterfaceBar3,
      InterfaceBar4,
      InterfaceBar5,
      InterfaceBar6,
      InterfaceBar7,
      InterfaceBar8,
      InterfaceBar9,
      InterfaceBar10,
      EssentialBar1,
      EssentialBar2,
      EssentialBar3,
      InterfaceBarNPos,
      InterfaceRepeatCommand,
      InterfaceToggleFullscreen,
      InterfaceEscapeMenu,
      InterfaceInventory,
      InterfaceCodex,
      InterfaceQuest,
      InterfaceCrafting,
      InterfaceInspectCursor,
    };


    Mods is a list of keyboard mods that need to be held down in order to trigger the action. More *may* be held down than just these, the game will match the greatest number of held down mods. (So if you have "Jump" set to RCtrl + Space and "Duck" set to Caps+LShift+Space, if you're holding down Caps+RCtrl+LShift+Space you will Duck instead of Jump).

    A list of mods is found here:

    Code:
    enum class StarKeyMod : uint16_t {
      NoMod = 0x0000,
      LShift = 0x0001,
      RShift = 0x0002,
      LCtrl = 0x0040,
      RCtrl = 0x0080,
      LAlt = 0x0100,
      RAlt = 0x0200,
      LMeta = 0x0400,
      RMeta = 0x0800,
      Num  = 0x1000,
      Caps = 0x2000,
      Mode = 0x4000,
      Reserved = 0x8000
    };


    "type" is one of "key", "mouse" or "joy" but "joy" isn't well tested, or tested at all, so YMMV. This is self-explanatory so moving on.

    "value" can be either a String or an unsigned int depending. The game will prefer and convert to String whenever possible, but in the case that the given button isn't configured in the game it will fall back to the computer's code for that button.

    For keyboard the list is located here (use the string in the second part of the line):

    Code:
    EnumMap<StarKey> const StarKeyNames{
      {StarKey::None, "None"},
      {StarKey::Backspace, "Backspace"},
      {StarKey::Tab, "Tab"},
      {StarKey::Clear, "Clear"},
      {StarKey::Return, "Return"},
      {StarKey::Pause, "Pause"},
      {StarKey::Escape, "Esc"},
      {StarKey::Space, "Space"},
      {StarKey::Exclaim, "!"},
      {StarKey::QuotedBL, "\""},
      {StarKey::Hash, "#"},
      {StarKey::Dollar, "$"},
      {StarKey::Ampersand, "&"},
      {StarKey::Quote, "\'"},
      {StarKey::LeftParen, "("},
      {StarKey::RightParen, ")"},
      {StarKey::Asterisk, "*"},
      {StarKey::Plus, "+"},
      {StarKey::Comma, ","},
      {StarKey::Minus, "-"},
      {StarKey::Period, "."},
      {StarKey::Slash, "/"},
      {StarKey::Zero, "0"},
      {StarKey::One, "1"},
      {StarKey::Two, "2"},
      {StarKey::Three, "3"},
      {StarKey::Four, "4"},
      {StarKey::Five, "5"},
      {StarKey::Six, "6"},
      {StarKey::Seven, "7"},
      {StarKey::Eight, "8"},
      {StarKey::Nine, "9"},
      {StarKey::Colon, ":"},
      {StarKey::Semicolon, ";"},
      {StarKey::Less, "<"},
      {StarKey::Equals, "="},
      {StarKey::Greater, ">"},
      {StarKey::Question, "?"},
      {StarKey::At, "@"},
      {StarKey::LeftBracket, "["},
      {StarKey::Backslash, "\\"},
      {StarKey::RightBracket, "]"},
      {StarKey::Caret, "^"},
      {StarKey::Underscore, "_"},
      {StarKey::Backquote, "`"},
      {StarKey::A, "A"},
      {StarKey::B, "B"},
      {StarKey::C, "C"},
      {StarKey::D, "D"},
      {StarKey::E, "E"},
      {StarKey::F, "F"},
      {StarKey::G, "G"},
      {StarKey::H, "H"},
      {StarKey::I, "I"},
      {StarKey::J, "J"},
      {StarKey::K, "K"},
      {StarKey::L, "L"},
      {StarKey::M, "M"},
      {StarKey::N, "N"},
      {StarKey::O, "O"},
      {StarKey::P, "P"},
      {StarKey::Q, "Q"},
      {StarKey::R, "R"},
      {StarKey::S, "S"},
      {StarKey::T, "T"},
      {StarKey::U, "U"},
      {StarKey::V, "V"},
      {StarKey::W, "W"},
      {StarKey::X, "X"},
      {StarKey::Y, "Y"},
      {StarKey::Z, "Z"},
      {StarKey::Delete, "Del"},
      {StarKey::Kp0, "Kp0"},
      {StarKey::Kp1, "Kp1"},
      {StarKey::Kp2, "Kp2"},
      {StarKey::Kp3, "Kp3"},
      {StarKey::Kp4, "Kp4"},
      {StarKey::Kp5, "Kp5"},
      {StarKey::Kp6, "Kp6"},
      {StarKey::Kp7, "Kp7"},
      {StarKey::Kp8, "Kp8"},
      {StarKey::Kp9, "Kp9"},
      {StarKey::Kp_period, "Kp_period"},
      {StarKey::Kp_divide, "Kp_divide"},
      {StarKey::Kp_multiply, "Kp_multiply"},
      {StarKey::Kp_minus, "Kp_minus"},
      {StarKey::Kp_plus, "Kp_plus"},
      {StarKey::Kp_enter, "Kp_enter"},
      {StarKey::Kp_equals, "Kp_equals"},
      {StarKey::Up, "Up"},
      {StarKey::Down, "Down"},
      {StarKey::Right, "Right"},
      {StarKey::Left, "Left"},
      {StarKey::Insert, "Ins"},
      {StarKey::Home, "Home"},
      {StarKey::End, "End"},
      {StarKey::PageUp, "PageUp"},
      {StarKey::PageDown, "PageDown"},
      {StarKey::F1, "F1"},
      {StarKey::F2, "F2"},
      {StarKey::F3, "F3"},
      {StarKey::F4, "F4"},
      {StarKey::F5, "F5"},
      {StarKey::F6, "F6"},
      {StarKey::F7, "F7"},
      {StarKey::F8, "F8"},
      {StarKey::F9, "F9"},
      {StarKey::F10, "F10"},
      {StarKey::F11, "F11"},
      {StarKey::F12, "F12"},
      {StarKey::F13, "F13"},
      {StarKey::F14, "F14"},
      {StarKey::F15, "F15"},
      {StarKey::Numlock, "Numlock"},
      {StarKey::Capslock, "Capslock"},
      {StarKey::Scrollock, "Scrollock"},
      {StarKey::RShift, "RShift"},
      {StarKey::LShift, "LShift"},
      {StarKey::RCtrl, "RCtrl"},
      {StarKey::LCtrl, "LCtrl"},
      {StarKey::RAlt, "RAlt"},
      {StarKey::LAlt, "LAlt"},
      {StarKey::RMeta, "RMeta"},
      {StarKey::LMeta, "LMeta"},
      {StarKey::LSuper, "LSuper"},
      {StarKey::RSuper, "RSuper"},
      {StarKey::Mode, "Mode"},
      {StarKey::Compose, "Compose"},
      {StarKey::Help, "Help"},
      {StarKey::Print, "Print"},
      {StarKey::SysReq, "SysReq"},
      {StarKey::Break, "Break"},
      {StarKey::Menu, "Menu"},
      {StarKey::Power, "Power"},
      {StarKey::Euro, "Euro"},
      {StarKey::Undo, "Undo"},
      };


    Because this relies directly on keycodes, if you have a non-US keyboard this list may not be exhaustive. In that case your best bet is to use the GUI to tell you what keycode you have, simply select a binding and rebind to that key, you should get Key_#, and it's the # part that you put into value.

    For the mouse buttons:

    Code:
    EnumMap<MouseButton> const MouseButtonNames{
      {MouseButton::None, "None"},
      {MouseButton::Left, "Left"},
      {MouseButton::Middle, "Middle"},
      {MouseButton::Right, "Right"},
      {MouseButton::WheelUp, "WheelUp"},
      {MouseButton::WheelDown, "WheelDown"},
      {MouseButton::WheelLeft, "WheelLeft"},
      {MouseButton::WheelRight, "WheelRight"},
      {MouseButton::FourthButton, "FourthButton"},
      {MouseButton::FifthButton, "FifthButton"},
      };
    


    And similarly, if you have a mouse with more than 5 buttons, a scroll wheel and a left/right scroll jog, you'll need to use the mouse button code.
     
    Tamorr likes this.
  2. Cutiesaurs

    Cutiesaurs Aquatic Astronaut

    The first mission to get the FTL drive working shouldn't be hard at all. I keep dying over again with attack that come from nowhere.
     
  3. Fytayn

    Fytayn Void-Bound Voyager

    I've been having a problem with the GUI: when I rebind tilde (` or ~) it still has the "unselect bar item" function. Other binds work, just not that one. And sometimes when I try to rebind it the rebind does something weird like the commands for the emotes instead of just adding tilde. I want to fully unbind it because I use it for Mumble and deselecting my bar item makes using it for push-to-talk troublesome.

    ...And while I'm here hotkeys for beam to orbited planet/up to ship, as well as setting zoom level for the game, would be really appreciated. Thanks!
     
  4. Baroncrow

    Baroncrow Yeah, You!

    Hey! I need some help on this note please! I have over a hundred hours into the game, and Every single play session, I accidentally tell one of my followers to "take a walk" while they are hovering right next to something else that I am pressing the "Interact" key with. This is so horribly annoying. I don't know how to follow up on this forum, but could someone tell me what I'm doing wrong? Rather than bad aiming with the mouse? It happens SOOOOOOO often. My email is claycrow@aol.com Thanks!!!!!!!!
     
    Katma and marc e like this.
  5. DraikNova

    DraikNova Spaceman Spiff

    Is it at all possible to add in keybinding actions via modding? Because it's really a pain to be limited to just a few keys to trigger Lua scripts when there's an entire keyboard's worth that's technically available.
     
  6. LordDaddy

    LordDaddy Void-Bound Voyager

    Hi,

    Is it possible to bind through unrecognized key code ? I have some keys like 'é' (eacute) that is not recognized (AZERTY). I tried putting 'EACUTE' in value but it does not work. GUI would not respond when pressing the key.

    How can I configure that ? Is there a list of the code for every key ?

    Thanks guys !
     
  7. Soundtoxin

    Soundtoxin Scruffy Nerf-Herder

    Is binding an action to extra mouse buttons still possible? I'm unable to get it to work following the info here.
     

Share This Page