multiple actionMap binds to one function
by Cameron Altenhof-Long · in Torque Game Engine · 10/31/2001 (8:19 pm) · 33 replies
I discovered an anomaly today in the show.bind.cs script provided with the show mod. This script contains commands to bind the various number keys to a single function, each using the scale modifier to pass a different value. Unfortunately, only the last bind works.
In review of the code (sim/actionMap.cc) I found a comment near line 1016 indicating that a decision was made to only allow one bind per function. If possible, can you please shed light on why this decision was made, and what potential problems may occur if multiple binds are allowed per command.
The ability to bind the number keys to a common function passing scaled values seem quite useful, but there must have been a reason that this capability was disabled.
Thank you in advance for your time and feedback on this issue.
Cameron
In review of the code (sim/actionMap.cc) I found a comment near line 1016 indicating that a decision was made to only allow one bind per function. If possible, can you please shed light on why this decision was made, and what potential problems may occur if multiple binds are allowed per command.
The ability to bind the number keys to a common function passing scaled values seem quite useful, but there must have been a reason that this capability was disabled.
Thank you in advance for your time and feedback on this issue.
Cameron
#23
02/08/2006 (3:39 pm)
Good fix, but yeah, seemed to be needed still to fix.
#24
03/16/2006 (3:16 pm)
Tom: I don't know what's up with the while() loop you have in that script, but, unless I'm missing something, this will do the same thing:%oldBind = moveMap.getBinding(%cmd);
if(%oldBind !$= "")
moveMap.unbind(getWord(%oldBind, 0), getWord(%oldBind, 1));
#25
(Since you are now able to add multiple binds for an action, getBinding() will give you only the first one found)
03/16/2006 (3:25 pm)
Josh, the above code makes sure, all bindings for an action are removed, not just one, as in your snippet.(Since you are now able to add multiple binds for an action, getBinding() will give you only the first one found)
#26
03/16/2006 (3:29 pm)
Ah thanks for clearing that up. I was indeed missing something! ;)
#27
It still would be super freaking cool if someone reworked the options dlg to support binding 2 or 3 different keys to the same function. If this happened i'm sure Ben would consider adding my fix and the fixed options dialog into HEAD.
03/16/2006 (3:52 pm)
@Josh - Markus is correct. The issue is that the options dialog isn't designed to display multiple key bindings to the same function. So if i didn't remove all other bindings first, there could possibly be hidden bindings.It still would be super freaking cool if someone reworked the options dlg to support binding 2 or 3 different keys to the same function. If this happened i'm sure Ben would consider adding my fix and the fixed options dialog into HEAD.
#28
04/26/2006 (3:24 am)
I'm willing to pitch in and pay a bounty to the first person who shows adequetly how the optionsDlg could be reworked to allow for more than a single KeyBind for each command in an elegant fashion. And either post the code here or as a resource.
#29
*Starts reading the torque books*
*Searches Tork.Beffy.de thoroughly*
04/26/2006 (3:39 am)
I would appreciate something like this aswell, but I have no extra cash...*Starts reading the torque books*
*Searches Tork.Beffy.de thoroughly*
#30
05/12/2006 (2:43 pm)
Actually i have a contract currently that needs just this... assigning multiple keybinds to the same function in the OptionsDlg. I'll see if he'll let me post my work on the updated OptionsDlg here.
#31
06/12/2006 (8:25 am)
FYI. I got this working now with the options dialog showing and managing multiple bindings to one action. I'll talk to our client today and see if he'll allow me to post the changes as a resource.
#32
06/12/2006 (9:07 am)
Please do!
Torque Owner Dave D