Keyboard Console Methods Syntax
by Gordon Marsh · in General Discussion · 07/10/2006 (6:27 pm) · 2 replies
All,
I am having a bit of trouble with Torque Script syntax for calling a ConsoleMethod when binding to a keyboard key.
I can call my ConsoleMethod successfully with no parameters such as:
moveMap.bindCmd(keyboard, "x", "", "$player.func1();");
but as soon as I try to pass a variable such as:
moveMap.bindCmd(keyboard, "x", "", "$player.func1('a');");
the function is called but 'a' is not passed... when I examine the parameter in the console method I get one of those funny little squares and 43. I'm not sure if this is caused by an incorrect type being passed, or just garbage.
Any help much appreciated!
Gords
I am having a bit of trouble with Torque Script syntax for calling a ConsoleMethod when binding to a keyboard key.
I can call my ConsoleMethod successfully with no parameters such as:
moveMap.bindCmd(keyboard, "x", "", "$player.func1();");
but as soon as I try to pass a variable such as:
moveMap.bindCmd(keyboard, "x", "", "$player.func1('a');");
the function is called but 'a' is not passed... when I examine the parameter in the console method I get one of those funny little squares and 43. I'm not sure if this is caused by an incorrect type being passed, or just garbage.
Any help much appreciated!
Gords
#2
I managed to get around my issue by using "" quotation marks instead of '' ones - otherwise the console method gets confused!
I didn't use these before as it fouled up because I didn't use escape characters in front of the quotes as below:
moveMap.bindCmd(keyboard, "x", "$player.func1(\"x\");", "");
07/11/2006 (5:14 am)
Anthony, I got a message back regarding incorrect number of arguments when I tried your code, but thanks for trying!I managed to get around my issue by using "" quotation marks instead of '' ones - otherwise the console method gets confused!
I didn't use these before as it fouled up because I didn't use escape characters in front of the quotes as below:
moveMap.bindCmd(keyboard, "x", "$player.func1(\"x\");", "");
Associate Anthony Rosenbaum