-1

Having an issue with this simple loop showing up an error. For reference im using a Logitech g502 lightspeed.

1.   function OnEvent(event, arg)
2. 
3.   if (event == "MOUSE_BUTTON_PRESSED" and arg == 8) then
4.   PressAndReleaseKey("spacebar")
5.   repeat
6.   MoveMouseRelative(0,3)
7.   Sleep(5)
8.   until not IsMouseButtonPressed(8)
9.   end
10.
11.  end

Lua Error (8): invalid argument Line Number:8

I have also tried "while IsMouseButtonPressed(8) do"

For some reason this works flawlessly when I bind it to mouse button 1, but stops working when I bind it to mouse button 8. Not sure if its a software limitation. Any help would be much appreciated!

Edit: I have read that "IsMouseButtonPressed()" only works on buttons 1-5. Does that mean its not possible to put a loop on button 8?

L.Kent
  • 1
  • 3

1 Answers1

0

Yes, IsMouseButtonPressed() only works on buttons 1-5.
Solution: assign action "Back" to the physical button #8 (on the big picture of mouse in LGS/GHub).
"Back" is the default action for button #4, so you can write IsMouseButtonPressed(4) now to detect if button #8 is down.

If abusing "Back" action is not suitable for you, see alternative ways in the comments below that answer.

ESkri
  • 1,461
  • 1
  • 1
  • 8