Bridge Commander Central
BC Forums => BC Scripting => Topic started by: vonfrank on March 05, 2009, 11:06:55 PM
-
Is there any way to add a command to a keyboard shortcut?
for example, i want to add the "redistribute shields" command to a keyboard button like "CTRL-S" or something.
there are other things i would like to make shortcuts for but i need to know how first
any sudgestions would be appreciated :D
-
The easiest way is to use my KeyFoundation, included in KM, it's old and buggy, but it does work, most of the time.
Look in WalkFX on how to use it.
Don't forget, you have to assign the actual key in the key config (options menu)!
-
Thanks :D
ill let you know if i need any more help
-
alright, i tried to understand what is in the file you sudgested, and i copiyed the approrpiate lines into the "Redistribute shields" file and changed the text to pretain to it, but it did not work, the "Redistribute shields" button dissapeared and no new key binding option appeared in the config. menu
if you can spare the time, i would appreciate a step by step procedure on what to copy into what files
thanks :D
-
If the button suddenly dissappeared, then an error occurred before that particular code could run, please get a console report.
-
it still wont work
here is the file, if anyone knows how to fix it please try
-
Here is a hint, where do you think "mode" comes from?
-
i'm not really sure :shock:
any tips?
-
Remove the , { ... } part and try again, it should (if memory serves) default to a stock mutator.
-
still didn't work
i changed it to:
Foundation.g_kKeyBucket.AddKeyConfig(Foundation.KeyConfig("Redistribute Shields", "RedistributeShields", ET_KEY_EVENT, App.KeyboardBinding.GET_INT_EVENT, 1, "Ship" ))
is that what you meant
-
So you don't get a Redistribute Shields option in the Ship key options?
Try to first start a QB before heading into the key options.
Since you are using QBAutoStart it's possible that it isn't loaded untill then.
-
well now i have the button in the config menu
but the binding wont work when i press it
is there some other file i need to put the binding info in to make the action work?
-
Well, for starters, you don't bind "ET_KEY_EVENT" to anything.
First you have to create a new one (before it!) through this:
ET_KEY_EVENT = App.UtopiaModule_GetNextEventType()And then you need to bind it. In this case (mostlikely) to:
App.TopWindow_GetTopWindow().FindMainWindow(App.MWT_OPTIONS).AddPythonFuncHandlerForInstance(ET_KEY_EVENT, __name__ + ".RedistributeShields")
-
sorry for bringing this up again from so long ago, but i got distracted with Galaxy Charts 2.0 and other new mods released recently.
in regards to your last post...
i am a little confused on where exactly i put those lines of code
do i place them in the Redistribute shileds file or do i put them somewhere else?
some parts of python modding are easy to get, but others are difficult for me, sorry
-
sorry for bringing this up again from so long ago, but i got distracted with Galaxy Charts 2.0 and other new mods released recently.
in regards to your last post...
i am a little confused on where exactly i put those lines of code
do i place them in the Redistribute shileds file or do i put them somewhere else?
some parts of python modding are easy to get, but others are difficult for me, sorry
I've attached the relevant files so you can to take a look at them. FYI this will also add a "Redistribute Shields" mutator to the game.
I'll further look into the matter tomorrow to see if there's a less complicated way.
-
Unfortunately it still doesn't work
i get the mutator and the binding option in the config. menu and if you click the redistribute shields button from the tactical officer menu it works fine but i set the binding to work when you press the "f" key, however nothing happens when i do so. :(
-
Strange, it works for me. Does the console say anything after you pressed the button?
-
the console report doesn't mention anything about it
the shortcut simply doesn't work for me :'(
-
Do the key bindings for other mods work?
Anyway you probably have to wait for MLeo in order to fix this.
-
Yes they do
only this one (as far as i know) doesnt work
-
OK Problem solved :D
i dont know what exactly the issue was but after re-installing the entire game (including KM and Galaxy Charts) the shortcut worked
thanks for all of the help everyone :)
-
Thanks from me too. The script works perfectly :)