Redefine keys
by Bruno · in Torque Game Builder · 01/06/2006 (4:46 am) · 1 replies
I got this working, i simply have a GuiTextEditCtrl control, where the user types the key he wants, and it works fine.
However, what i was tryng now to do was that, if the player for example wants to use the Space key, that
when he hits the space, instead of showing a space in the text control gui, that would show the string "SPACE", and the same thing for the CTRL key and so on.
To do this, i need to know when a key was pressed inside the control window.., is there a callback for this ?
And then, i need to be able to catch the ASCII code of the input key, is there some way to do this too ?
The code would be something like this :
function key_up::OnInput(%text)
{
if(%text == #32) key_up.setText("SPACE");
}
The problem is, i just don't know the syntax, or even if this can be done..,
thanks,
Bruno
However, what i was tryng now to do was that, if the player for example wants to use the Space key, that
when he hits the space, instead of showing a space in the text control gui, that would show the string "SPACE", and the same thing for the CTRL key and so on.
To do this, i need to know when a key was pressed inside the control window.., is there a callback for this ?
And then, i need to be able to catch the ASCII code of the input key, is there some way to do this too ?
The code would be something like this :
function key_up::OnInput(%text)
{
if(%text == #32) key_up.setText("SPACE");
}
The problem is, i just don't know the syntax, or even if this can be done..,
thanks,
Bruno
About the author
Torque Owner Jason Swearingen
but all callbacks get processed by a single function (in c++), that then decides what script function to execute.
sorry i cant be more exact than that.. but i think the c++ function is Con::Execute. my suggestion is to modify that function to print all calls that go thru it to the console (or log it to a text file) and then start banging keys or whatever you want to figure out and then look at what got logged....