Middle-click and other buttons to "use" something

Author Topic: Middle-click and other buttons to "use" something  (Read 997 times)

Was wondering if the middle mouse button can be incorporated in the code to work as an "activation" button, similar to how the function Armor::onTrigger works for the right-click mouse button (at least as far as I can tell, lol). If so, would the button activate the thing it is bound to, if it is at all (Ex. I have my middle mouse click bound to open my Spray Can tool, if the middle mouse button was scripted to do something else for an item you were holding, would it immediately open my Spray Can tool afterwards?).

Doesn't seem very likely for some reason but worth a try to ask. Was also wondering if any of the other buttons on the keyboard could be scripted to do something for an item you were holding? Thanks.

Yes, you use packages. The problem is that you need to assume that the user is using the default keymapping because you can't package the key press, only the function. Say I package toggleLight to change from my hammer to wrench and back. If I have the default map, I'd need to press R to switch. Since I use the old default, I need to press L because that's the key I have mapped to the light function.

Since the middle mouse button is not set to anything by default you can’t detect for sure when someone uses it like you are able to with the other buttons.

can only override functions that are sent to the server (ie /uselight, /sit, and so on are keybound, and the player datablock triggers), I think the brick menu might be included with that
if you're on the client side, you have a lot more control over specific keys/letting the user bind keys

OK thank you all. Probably will just stick with left and right mouse buttons and whatnot, it'll work :P
« Last Edit: September 24, 2017, 11:49:01 PM by xS K I D z »