[Closed] Callback question
Is there a way to detect if the left or middle mouse button is pressed during a callback? Or is there a way to register a callback only when the left or middle mouse button is pressed?
The mouse.buttonStates global variable sounds like the answer for this, but I have been unable to get any of the three buttons to report a “true” value (i.e. down) in Max 5. Looks like a bug…?
If you can get it to report the button states correctly, then you’d be able to use the mouse.buttonStates[2] value as a test expression in a callback string or your script code.
Example 1:
if (mouse.buttonStates[2]) do (callbacks.addScript #preRender [color=maroon][font=‘Courier New’]”…”[/color] id:#myCallBacks[/font])
Example 2:
callbacks.addScript #preRender [color=maroon][font=‘Courier New’]”[font=Verdana][color=#ffffff]if (mouse.buttonStates[2]) do (…)”[/font][/color][/color] id:#myCallBacks[/font]
Well it seems that I can read the mouse.buttonstate from within a callback fn. As you said it doesnt seem to read the mouse button state correctly. In my case it reads when the mouse button is pressed, but not when the button is released. I’m trying to find a work around now.