Page 1 of 1
Custom keybindings for custom code

Posted:
Sat Dec 20, 2014 12:13
by leeminer
I think Wuzzy brought this up in another thread, but here goes. I want to add new keys that when pressed execute code or chat commands that I setup.
For example, in the mod I am developing, I want two keys to change the jump height. One to increase it and one to decrease it.
Is this even possible? This would be really cool, not just for my mod but for any mod or game attempted with Minetest.
Re: Custom keybindings for custom code

Posted:
Sat Dec 20, 2014 12:17
by rubenwardy
You could edit the core code of Minetest to add this, but it wouldn't be very flexible. (ie: in the game class, look for a key press, if it is pressed then run a chat command).
Function keys would be nice - the user defines which chat commands are run when a key is pressed.
Re: Custom keybindings for custom code

Posted:
Sat Dec 20, 2014 23:07
by philipbenr
That was put in the Wishes for 0.4.11 or 0.5 thread. I think the devs get the picture that this is really wanted. However, this brings up a problem. Too many people would use this and eventually the entire keyboard would be filled from all the cool mods (very unlikely but still...). I think using chat commands will be the best, instead of single keys, because there are infinitely more combos than with single keys.
Re: Custom keybindings for custom code

Posted:
Sun Dec 21, 2014 13:54
by rubenwardy
It should be a client side thing, not a mod thing. (what chat command or action a key does is set on the client side.)
Re: Custom keybindings for custom code

Posted:
Sun Dec 21, 2014 18:06
by Inocudom
I myself use a tablet, so it would be helpful if the functions of the mouse's buttons could be changed/moved.
Re: Custom keybindings for custom code

Posted:
Sun Dec 21, 2014 18:20
by Don
I agree with philipbenr. The chances of key binding conflicts would be an issue. This could become a mess. If nothing stops me from using the same key binding as you then the end user will suffer.
Re: Custom keybindings for custom code

Posted:
Mon Dec 22, 2014 19:43
by rubenwardy
Don wrote:I agree with philipbenr. The chances of key binding conflicts would be an issue. This could become a mess. If nothing stops me from using the same key binding as you then the end user will suffer.
Please read my suggestion.
Re: Custom keybindings for custom code

Posted:
Mon Dec 22, 2014 20:06
by Don
rubenwardy wrote:Don wrote:I agree with philipbenr. The chances of key binding conflicts would be an issue. This could become a mess. If nothing stops me from using the same key binding as you then the end user will suffer.
Please read my suggestion.
Sorry. I agree with you too.