Parse help
by Anthony Ratcliffe · in Torque Game Builder · 09/28/2007 (7:17 am) · 8 replies
Hey i'm getting a parse error on line 37 can anyone help?
function startGame(%level)
{
// Set The GUI.
Canvas.setContent(mainScreenGui);
Canvas.setCursor(DefaultCursor);
moveMap.push();
%levelToCheck = %level @ ".dso";
if( isFile( %level ) || isFile( %level @ ".dso"))
sceneWindow2D.loadLevel(%level);
}
//---------------------------------------------------------------------------------------------
// endGame
// Game cleanup should be done here.
//---------------------------------------------------------------------------------------------
function FishClass::onLevelLoaded(%this, %scenegraph)
{
%this.setLinearVelocityX(20);
}
{
sceneWindow2D.endLevel();
moveMap.pop();
}
function startGame(%level)
{
// Set The GUI.
Canvas.setContent(mainScreenGui);
Canvas.setCursor(DefaultCursor);
moveMap.push();
%levelToCheck = %level @ ".dso";
if( isFile( %level ) || isFile( %level @ ".dso"))
sceneWindow2D.loadLevel(%level);
}
//---------------------------------------------------------------------------------------------
// endGame
// Game cleanup should be done here.
//---------------------------------------------------------------------------------------------
function FishClass::onLevelLoaded(%this, %scenegraph)
{
%this.setLinearVelocityX(20);
}
{
sceneWindow2D.endLevel();
moveMap.pop();
}
About the author
#2
09/28/2007 (7:35 am)
Wat function should i start with i'm really new
#3
Gabriel
09/28/2007 (7:48 am)
I think that function is supposed to be called endGame(). Your script here is somewhat resembles what is in game.cs. You probably deleted the function header by mistake.Gabriel
#4
I've marked it in bold:
09/28/2007 (7:55 am)
I agree with Gabriel, you're missing the header of your last function.I've marked it in bold:
function startGame(%level)
{
// Set The GUI.
Canvas.setContent(mainScreenGui);
Canvas.setCursor(DefaultCursor);
moveMap.push();
%levelToCheck = %level @ ".dso";
if(isFile(%level) || isFile(%level @ ".dso"))
sceneWindow2D.loadLevel(%level);
}
//---------------------------------------------------------------------------------------------
// endGame
// Game cleanup should be done here.
//---------------------------------------------------------------------------------------------
function FishClass::onLevelLoaded(%this, %scenegraph)
{
%this.setLinearVelocityX(20);
}
[b]function endGame()[/b]
{
sceneWindow2D.endLevel();
moveMap.pop();
}
#5
09/28/2007 (9:04 am)
Thanks i thought the fish class would replace the endgame function
#6
09/28/2007 (9:11 am)
Well even if it did you still can't have syntax errors in your script. E.g. functions without a header.
#7
09/28/2007 (3:51 pm)
Ok used the above code cut and pasted, now getting no movement in the fish which is named under FishClass and a syntex error 1 :S really confused
#8
Put all your custom code in a new file (fish.cs for example) and then add an exec line to your main.cs or game.cs
That fish class really belongs somewhere else.
10/14/2007 (12:51 am)
Anthony, don't edit main.cs or game.cs except when specifically told to (usually to exec another script).Put all your custom code in a new file (fish.cs for example) and then add an exec line to your main.cs or game.cs
That fish class really belongs somewhere else.
Torque 3D Owner Eric Armstrong
Bloody Tongue Games