Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- 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
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement