Game Development Community

Console indicating errors, how to know what?

by Scott Turner · in Torque Game Builder · 05/28/2005 (3:46 pm) · 2 replies

The console is telling me this:

--------- Parsing Arguments ---------

--------- Initializing MOD: Common ---------
Loading compiled script common/client/canvas.cs.
Loading compiled script common/client/audio.cs.

--------- Initializing MOD: T2D ---------
Compiling T2D/client/client.cs...
T2D/client/client.cs Line: 195 - Syntax error.
>>> Advanced script error report. Line 389.
>>> Some error context, with ## on sides of error halt:
playerMap.bindCmd (keyboard, "space", "playerFire();", "");



//Activate the action map.

playerMap.push();



function ##C##reateEnemy()

{

//create an enemy ship

%enemy = new fxStaticSprite2D() { scenegraph = t2dSceneGraph; };
>>> Error report complete.


and this is my code for that section:

function CreatePlayer()
{
// Create the player's ship sprite
$player = new fxStaticSprite2d() { scenegraph = t2dSceneGraph; };
$player.setPosition("-30 0");
$player.setSize("60 30");
$player.setImageMap (playershipImageMap );
$player.fireLinkPoint = $player.addLinkPoint( "0.45 0.2" );
$player.setWorldLimit( clamp, "-49 -37 40 37");

// Create a new action map.
new ActionMap (playerMap);

// Bind keys to actions.
playerMap.bindCmd (keyboard, "w", "playerUp();", "playerUpStop();");
playerMap.bindCmd (keyboard, "s", "playerDown();", "playerDownStop();");
playerMap.bindCmd (keyboard, "a", "playerLeft();", "playerLeftStop();");
playerMap.bindCmd (keyboard, "d", "playerRight();", "playerRightStop();");
playerMap.bindCmd (keyboard, "space", "playerFire();", "");

//Activate the action map.
playerMap.push();

function CreateEnemy()
{
//create an enemy ship
%enemy = new fxStaticSprite2D() { scenegraph = t2dSceneGraph; };
%enemy.setSize( "28 14");
%enemy.setPosition ("40 0");
%enemy.setImageMap ( enemyship1ImageMap );



My question is, can somebody help me decipher what is the error (again) and second, how do I know what the console is pointing me to fix? it says syntax error, what exactly is a syntax error? Im sorry for my noobishness, Im doing my best effort to learn T2d, thank you very much.

#1
05/28/2005 (4:08 pm)
function ##C##reateEnemy()

is the line you are looking for. As it says, # signs are put where errors were detected. A syntax error usually means that you made a typo or forgot to add curly braces or a semicolon.
#2
05/28/2005 (4:12 pm)
To be more specific, your problem is that you forgot to close the braces on your CreatePlayer function. You cannot create another function within a function. The compiler gives you an error at the first point where it realizes that you are trying to create a function within a function.