Skip to content

Suggestion for new PS3 controller config #2

Description

@icexuick

Below lines for PS3 controller setup:

----------------------------------- Playstation 3 Controller -----------------------------------------
----Combined with ScpToolikit https://www.lifewire.com/how-to-connect-ps3-controller-to-pc-4589297----
-- Each input is a table of {'axes'|'buttons'|'hats', index (lua 1-based), direction (1 | -1)}
local LeftXAxis = {'axes',1,1} -- move left-right
local LeftYAxis = {'axes',2,1} -- move forward-backward
local RightXAxis = {'axes',3,1} --turn left-right
local RightYAxis = {'axes',4,1} --turn up-down
local RightTrigger = {'axes',6,1} -- move up
local LeftTrigger = {'axes',5, 1} --move down
local DpadUp = {'hats',1,1} -- increase speed
local DpadDown = {'hats',1,-1} -- decrease speed
local DpadRight = {'hats',2,1} -- increase smoothing
local DpadLeft = {'hats',2,-1} -- decrease smoothing
local Abutton = {'buttons',1,1} -- cross button, pause game
local Bbutton = {'buttons',2,1} -- circle button, hide interface
local Xbutton = {'buttons',3,1} -- square button, toggle los 
local Ybutton = {'buttons',4,1} -- triangle button, print joystick status
local LShoulderbutton = {'buttons',5,1} -- decrease game speed
local RShoulderbutton = {'buttons',6,1} -- increase game speed
local RStickButton = {'buttons',10,1} -- Toggle maximum minimap
local LStickButton = {'buttons',9,1} -- Toggle defense ranges GL4
local SelectButton = {'buttons',7,1} -- specfullview
local StartButton = {'buttons',8,1} -- DOF toggle
--

Improved Binds

------------- BIND COMMANDS TO BUTTONS DEBOUNCED! -------------------------------
local buttonCommands = { -- key is button number, value is command like you would type into console without the beginning /
  [Abutton[2]] = function() Spring.SendCommands("pause") end,
  [Bbutton[2]] = function() Spring.SendCommands("hideinterface") end, 
  [Xbutton[2]] = function() Spring.SendCommands("togglelos") end, 
  [LShoulderbutton[2]] = function() Spring.SendCommands("slowdown") end,
  [RShoulderbutton[2]] = function() Spring.SendCommands("speedup") end,
  [RStickButton[2]] = function() Spring.SendCommands("MiniMap Maximize") end,
  [LStickButton[2]] = function() Spring.SendCommands("luaui togglewidget Defense Range GL4") end,
  [SelectButton[2]] = function() Spring.SendCommands("SpecFullView") end,
  [StartButton[2]] = function() Spring.SendCommands("option dof") end,
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions