GenericInputActionBehavior always says Unknown command
by Ray Depew · in Torque Game Builder · 10/06/2007 (2:10 pm) · 3 replies
I'm trying to use the GenericInputActionBehavior. I have assigned the behavior to recognize a certain key.
The problem is that any command I enter in the "command" field generates an "Unknown command" error in console.log.
Originally, thinking that the command might need to be a player function, I had put the function in player.cs, like this:
Then, thinking that the command might need to be a GenericInputAction function, I put it in genericInputAction.cs, like this:
So if put "echo(%val))" in the command field, figuring that that would give me a "1" on one line, and a "0" on the next line. Instead, I get two lines of "echo(%val): Unknown command", one line for key down, and one line for key up.
The most basic command is the "echo" command. This is the only command I tried that doesn't error out, but it still doesn't work right. I figured that if I entered just "echo" in the command field, then the behavior would generate "echo(1)" on key down, and "echo(0)" on key up, so I should get a "1" on one line, and a "0" on the next line. Instead I get two blank lines.
Where is it looking for the commands? Why does it even call "echo(whatever)" an unknown command?
The problem is that any command I enter in the "command" field generates an "Unknown command" error in console.log.
Originally, thinking that the command might need to be a player function, I had put the function in player.cs, like this:
function player::doSomething( %this, %val ) { ...} and entered "player.doSomething" in the behavior's command field, but I got two lines of "player.doSomething: Unknown command".Then, thinking that the command might need to be a GenericInputAction function, I put it in genericInputAction.cs, like this:
function GenericInputActionBehavior::doSomething( %val )and entered "doSomething" in the behavior's command field, but I still got two lines of "doSomething: Unknown command".
So if put "echo(%val))" in the command field, figuring that that would give me a "1" on one line, and a "0" on the next line. Instead, I get two lines of "echo(%val): Unknown command", one line for key down, and one line for key up.
The most basic command is the "echo" command. This is the only command I tried that doesn't error out, but it still doesn't work right. I figured that if I entered just "echo" in the command field, then the behavior would generate "echo(1)" on key down, and "echo(0)" on key up, so I should get a "1" on one line, and a "0" on the next line. Instead I get two blank lines.
Where is it looking for the commands? Why does it even call "echo(whatever)" an unknown command?
#2
Please provide a line of code, using moveMap.bind that is working. They show me what you are entering for the behavior to duplicate that line of code.
Also, the behavior is using bind() not bindCMD(). So there is only one command, not one for keyup and one for keydown.
11/06/2007 (9:01 am)
Ray,Please provide a line of code, using moveMap.bind that is working. They show me what you are entering for the behavior to duplicate that line of code.
Also, the behavior is using bind() not bindCMD(). So there is only one command, not one for keyup and one for keydown.
#3
11/06/2007 (9:20 am)
Try making dummy functions for the binds which internally call echo.moveMap.bind(keyboard, space, testInput);
function testInput(%val)
{
echo("testing:" SPC %val);
}
Torque 3D Owner Ray Depew