Notifications
Clear all

[Closed] Please show me an example of mouse button functions

I’m trying to understand how to read the left and middle mouse buttons. I’m sure this must seem silly, but I can’t poll them for some reason. I’ve tried using lButton, mButton, and mouse.buttonStates, and can’t get any of them to work. Could someone please post some example code for me to look at and understand.

thanks in advance,
Stephen Lebed
VFX Supervisor/ Owner
MECHNOLOGY

1 Reply
1 Reply
(@f97ao)
Joined: 2 years ago

Posts: 0

Use mouse.buttonStates for this.

To get the left mouse button just write
mouse.buttonStates[1]

for the middle mousebutton it’s mouse.ButtonStates[2] and mouse.buttonStates[3] for the right button.

They will return true/false.

You normally want to combine this with the keyboard.
keyboard.ShiftPressed
keyboard.altPressed
keyboard.ControlPressed

These also return true/false

Hope that helps.

/Andreas