Page 1 of 1

Trying to hold mouse button down for a game

Posted: Tue Jul 03, 2018 6:31 am
by adamdwaldrop
hello, I am trying to figure out how to set the right mouse button down when a key is pressed on the keyboard, then release it when the same key is pressed (kinda like a toggle for holding the right mouse button down) Can Anyone help?

Re: Trying to hold mouse button down for a game

Posted: Tue Jul 03, 2018 7:35 am
by Jabberwock
This should work:

Code: Select all

if keyboard.getPressed(Key.LeftShift):
	mouse.setButton(1, not mouse.getButton(1))

Re: Trying to hold mouse button down for a game

Posted: Tue Jul 03, 2018 8:19 pm
by adamdwaldrop
Thanks, Looking for a way to hard-code hiding/showing the cursor now (So I don't have to rely on external libraries or programs!)