Advertisement
Guest User

Untitled

a guest
Mar 29th, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. -- this script will toggle Q and E with the g502's left (11) and right (10) scroll wheel buttons.
  2. -- that includes disabling one when the other is pressed, and vice versa.
  3.  
  4. isLeftPressed = false
  5. isRightPressed = false
  6.  
  7. function OnEvent(event, arg)
  8. --OutputLogMessage("event = %s, arg = %s\n", event, arg);
  9.  
  10. -- left pressed
  11. if event == "MOUSE_BUTTON_PRESSED" and arg == 11 then
  12. isLeftPressed = not isLeftPressed
  13. if isLeftPressed then
  14. --OutputLogMessage("pressing Q\n");
  15. PressKey("q");
  16. if isRightPressed then
  17. isRightPressed = false
  18. --OutputLogMessage("also releasing E\n");
  19. ReleaseKey("e");
  20. end
  21. else
  22. --OutputLogMessage("releasing Q\n");
  23. ReleaseKey("q");
  24. end
  25. end
  26.  
  27. -- right pressed
  28. if event == "MOUSE_BUTTON_PRESSED" and arg == 10 then
  29. isRightPressed = not isRightPressed
  30. if isRightPressed then
  31. --OutputLogMessage("pressing E\n");
  32. PressKey("e");
  33.  
  34. if isLeftPressed then
  35. isLeftPressed = false
  36. --OutputLogMessage("also releasing Q\n");
  37. ReleaseKey("q");
  38. end
  39. else
  40. --OutputLogMessage("releasing E\n");
  41. ReleaseKey("e");
  42. end
  43. end
  44. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement