GetBinding(), keybinds.cs and the lack of bind.cs
by Sabbie · in Torque Game Builder · 12/19/2007 (9:59 am) · 2 replies
I'm trying to build some functionality to change the controls ingame but once again the lack of documentation is bringing me to a quick halt.
First off, I wanted to show the player what keys currently are being used for the various functions, so I tried to do return them with the getBinding() command. I've tried:
moveMap.getBinding("shoot");
moveMap.getBinding("shoot()");
moveMap.getBinding(shoot);
And some other ideas that are even less likely to work, but nothing works.
When I tried the following:
moveMap.getCommand("keyboard","e");
it does return the shoot function, so then I tried this:
moveMap.getBinding(moveMap.getCommand("keyboard","e"));
Still no go..
Then I decided to move on and try setting the bindings first. When the GUI Builder got me confused again (couldn't do anything besides quitting it after importing a GuiInputCtrl element) I started to look in the common directory and found keybindings.cs and remap.gui.
I spawned the remap.gui and it did work with keybindings.cs, but gave me an error:
common/gameScripts/keybindings.cs (117): Unable to find object: '' attempting to call function 'getCommand'
A little more searching let me to the ingame documentation wich told me there should be a bind.cs in the common\preferences directory. This file is nowhere to be found, and after trying for almost a day I gave up and came here.
To summorize, my questions:
1. How does getBinding work and/or what am I doing wrong?
2. Where is bind.cs, do I need it, and what should go in there? (In the same line: I don't have a prefs.cs either)
3. In what direction should I go to be able to get my moveMap to work with keybindings.cs or in what direction should I go to be able to set keys ingame.
I'm using TGB 1.6 btw, have tried the getBindings() in 1.5.1. aswell with the same result. I don't have access to the engine source.
Thanks,
First off, I wanted to show the player what keys currently are being used for the various functions, so I tried to do return them with the getBinding() command. I've tried:
moveMap.getBinding("shoot");
moveMap.getBinding("shoot()");
moveMap.getBinding(shoot);
And some other ideas that are even less likely to work, but nothing works.
When I tried the following:
moveMap.getCommand("keyboard","e");
it does return the shoot function, so then I tried this:
moveMap.getBinding(moveMap.getCommand("keyboard","e"));
Still no go..
Then I decided to move on and try setting the bindings first. When the GUI Builder got me confused again (couldn't do anything besides quitting it after importing a GuiInputCtrl element) I started to look in the common directory and found keybindings.cs and remap.gui.
I spawned the remap.gui and it did work with keybindings.cs, but gave me an error:
common/gameScripts/keybindings.cs (117): Unable to find object: '' attempting to call function 'getCommand'
A little more searching let me to the ingame documentation wich told me there should be a bind.cs in the common\preferences directory. This file is nowhere to be found, and after trying for almost a day I gave up and came here.
To summorize, my questions:
1. How does getBinding work and/or what am I doing wrong?
2. Where is bind.cs, do I need it, and what should go in there? (In the same line: I don't have a prefs.cs either)
3. In what direction should I go to be able to get my moveMap to work with keybindings.cs or in what direction should I go to be able to set keys ingame.
I'm using TGB 1.6 btw, have tried the getBindings() in 1.5.1. aswell with the same result. I don't have access to the engine source.
Thanks,
About the author
#2
Thanks a bunch :D
12/22/2007 (4:28 am)
Well, that's exactly what I wanted.. Apparently de command does work for keys that were bound with moveMap.bind(), but it doesn't work with keys that were bound with moveMap.bindCmd().Thanks a bunch :D
Chaim Krause
Chaim Gang
moveMap.bind(keyboard, "left", "foo"); moveMap.bind(keyboard, "right", "querry"); //.... function foo() { echo("we are in foo"); } function querry() { echo(moveMap.getBinding("foo")); }