Last active
July 18, 2023 16:11
-
-
Save ekilah/ce7ce9f5115536a8abe1ff7c0844138b to your computer and use it in GitHub Desktop.
Logitech Gaming Software Lua script to use a mouse (ie: G502) to toggle leaning in games that don't let you set leaning to a toggle, instead of a hold, in-game
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- this script will toggle Q and E with the g502's left (11) and right (10) scroll wheel buttons. | |
-- that includes disabling one when the other is pressed, and vice versa. | |
isLeftPressed = false | |
isRightPressed = false | |
function OnEvent(event, arg) | |
--OutputLogMessage("event = %s, arg = %s\n", event, arg); | |
-- left pressed | |
if event == "MOUSE_BUTTON_PRESSED" and arg == 11 then | |
isLeftPressed = not isLeftPressed | |
if isLeftPressed then | |
--OutputLogMessage("pressing Q\n"); | |
PressKey("q"); | |
if isRightPressed then | |
isRightPressed = false | |
--OutputLogMessage("also releasing E\n"); | |
ReleaseKey("e"); | |
end | |
else | |
--OutputLogMessage("releasing Q\n"); | |
ReleaseKey("q"); | |
end | |
end | |
-- right pressed | |
if event == "MOUSE_BUTTON_PRESSED" and arg == 10 then | |
isRightPressed = not isRightPressed | |
if isRightPressed then | |
--OutputLogMessage("pressing E\n"); | |
PressKey("e"); | |
if isLeftPressed then | |
isLeftPressed = false | |
--OutputLogMessage("also releasing Q\n"); | |
ReleaseKey("q"); | |
end | |
else | |
--OutputLogMessage("releasing E\n"); | |
ReleaseKey("e"); | |
end | |
end | |
end |
Something needs to be edited or just plug in Logitech software? thanks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
sorry about the tabbing, github isn't letting me fix it easily