MoveMap.bindCmd
by Robert Serocki · in Torque Game Builder · 11/12/2006 (9:32 pm) · 3 replies
I looked over some existing posts and found similar issues, but was unable to solve my particular problem, so:
I'm trying to get the proper datablock to appear in the Config Datablock dropdown menu, but it's not happening.
I've been using, in part, the shooter demo. There are no compilation errors being reported.
I've got the shooter demo's player.cs file and I've got a sprite with a name of pShip and class of playerShip, listed in the level editor GUI. I can see in the console that player.cs is being loaded.
The proper level file is also being loaded.
I initially put the exec statement for the player.cs file in the initializeProject() function in main.cs. When this
didn't work, I tried putting the contents of player.cs into configDatablocks.cs and did
exec("./gameScripts/configDatablocks.cs"); at the beginning of main.cs and I see in the console that it has loaded.
After checking the GUI after the files have been loaded according to the console, I still can't select a datablock from the drop-down menu. I noticed the lack of a drop-down option after I had problems trying to get key binding working properly -- moving the ship around.
So, my question is, what are some common errors that would lead to this problem, given my description?
I'm running this on mac OS X and I'm using Torque2D version v1.1.2, Torque Game Builder version v1.1.1
-thanks in advance
I'm trying to get the proper datablock to appear in the Config Datablock dropdown menu, but it's not happening.
I've been using, in part, the shooter demo. There are no compilation errors being reported.
I've got the shooter demo's player.cs file and I've got a sprite with a name of pShip and class of playerShip, listed in the level editor GUI. I can see in the console that player.cs is being loaded.
The proper level file is also being loaded.
I initially put the exec statement for the player.cs file in the initializeProject() function in main.cs. When this
didn't work, I tried putting the contents of player.cs into configDatablocks.cs and did
exec("./gameScripts/configDatablocks.cs"); at the beginning of main.cs and I see in the console that it has loaded.
After checking the GUI after the files have been loaded according to the console, I still can't select a datablock from the drop-down menu. I noticed the lack of a drop-down option after I had problems trying to get key binding working properly -- moving the ship around.
So, my question is, what are some common errors that would lead to this problem, given my description?
I'm running this on mac OS X and I'm using Torque2D version v1.1.2, Torque Game Builder version v1.1.1
-thanks in advance
#2
I had assumed it was necessary to associate the ship sprite with a datablock in the drop-down config datablock menu, but I checked the ScrollerDemo project, and no datablock is available in ScrollerDemo's ship's drop-down menu, either, yet the ship is still able to move about with keyboard input, so there must be another problem. There are no compilation errors and no warnings pertaining to likely sections of code, so I'll probably go through my own code again and will try to carefully compare my code to the demo's.
edit: A ha, when I hit a movement key, I'm getting (0); Unable to find object: '' attempting to call function 'playerMovement'... hm. Although I see this is very similar to 'T2D/gameScripts/game.cs (55): Unable to find object: 't2dScene' attempting to call function 'getId'' which was reported as being normal in the tdn wiki...
11/13/2006 (10:26 am)
Thank you, Gary,I had assumed it was necessary to associate the ship sprite with a datablock in the drop-down config datablock menu, but I checked the ScrollerDemo project, and no datablock is available in ScrollerDemo's ship's drop-down menu, either, yet the ship is still able to move about with keyboard input, so there must be another problem. There are no compilation errors and no warnings pertaining to likely sections of code, so I'll probably go through my own code again and will try to carefully compare my code to the demo's.
edit: A ha, when I hit a movement key, I'm getting (0); Unable to find object: '' attempting to call function 'playerMovement'... hm. Although I see this is very similar to 'T2D/gameScripts/game.cs (55): Unable to find object: 't2dScene' attempting to call function 'getId'' which was reported as being normal in the tdn wiki...
#3
is being loaded since I put echo("XXXXXXXXXXXXXXXXXXX");
into it and see it in the console. However, in the same function,
I have
moveMap.bindCmd(keyboard, "w", "echo(\"FOO\");", "echo(\"FOO\");");
among my other moveMap.bindCmd lines, but I can't get FOO to show up in the console by tapping w.
Am I mis-using the command in this manner? I'm trying to discern why it's being "ignored." Of course I'd use it for moving the player's ship around once I can get input acknowledged this way.
edit: Got it. I needed moveMap.push()
11/13/2006 (10:21 pm)
I know function playerShip::onLevelLoaded(%this, %scenegraph)is being loaded since I put echo("XXXXXXXXXXXXXXXXXXX");
into it and see it in the console. However, in the same function,
I have
moveMap.bindCmd(keyboard, "w", "echo(\"FOO\");", "echo(\"FOO\");");
among my other moveMap.bindCmd lines, but I can't get FOO to show up in the console by tapping w.
Am I mis-using the command in this manner? I'm trying to discern why it's being "ignored." Of course I'd use it for moving the player's ship around once I can get input acknowledged this way.
edit: Got it. I needed moveMap.push()
Torque Owner Gary Preston
Run the game from the level editor then check to see if your config datablock appears in the drop down. If it does, you just need to move the exec for the file containing your config datablock elsewhere. Such as just after the game.cs exec in initializeProject in main.cs.
If you've already tried that, then the other things to check are that firstly your config datablock is correct, double check for any typos and that you have a semi-colon after the closing curly brace.
Also open up the console.log file and run through it for any possible compilation errors, syntax errors or warnings that may help point you to the problem.