Need another set of eyes
by Robert Brown · in Torque Game Builder · 04/13/2014 (7:46 am) · 12 replies
I can not find the syntax error I have made I think I need another set of eyes. This is for the commercial engine last version released.
function playerClass::setCurrentAnimation(%this, %yVelocity)
{
if(%yVelocity < 0 )
{
%this.playAnimation(playerJumpUp);
}
else if(%yVelocity > 0 )
{
%this.playAnimation(playerJumpDown);
}
else
{
if(%this.moveLeft || %this.moveRight)
{
if(%this.getAnimationName() $= "playerRun")
{
if(%this.getIsAnimationFinished())
{
%this.playAnimation(playerRun);
}
}
else
{
%this.playAnimation(playerRun);
}
}
else
{
%this.playAnimation(playerStand);
}
}
function t2dSceneGraph::onUpdateScene()
{
$pGuy.updateMovement();
}
The error seems to be somewhere in this section but I can not find it. Any help would be appreciated
function playerClass::setCurrentAnimation(%this, %yVelocity)
{
if(%yVelocity < 0 )
{
%this.playAnimation(playerJumpUp);
}
else if(%yVelocity > 0 )
{
%this.playAnimation(playerJumpDown);
}
else
{
if(%this.moveLeft || %this.moveRight)
{
if(%this.getAnimationName() $= "playerRun")
{
if(%this.getIsAnimationFinished())
{
%this.playAnimation(playerRun);
}
}
else
{
%this.playAnimation(playerRun);
}
}
else
{
%this.playAnimation(playerStand);
}
}
function t2dSceneGraph::onUpdateScene()
{
$pGuy.updateMovement();
}
The error seems to be somewhere in this section but I can not find it. Any help would be appreciated
About the author
#2
04/13/2014 (1:39 pm)
Yes.
#3
function playerClass::setCurrentAnimation(%this, %yVelocity)
{
if(%yVelocity < 0 )
{
%this.playAnimation(playerJumpUp);
}
if(%yVelocity > 0 )
{
%this.playAnimation(playerJumpDown);
}
else if
{
if(%this.moveLeft || %this.moveRight)
{
if(%this.getAnimationName() $= "playerRun")
{
if(%this.getIsAnimationFinished())
{
%this.playAnimation(playerRun);
}
}
} <===== Right here ====================
else
{
%this.playAnimation(playerRun);
}
}
else
{
%this.playAnimation(playerStand);
}
}
04/13/2014 (2:22 pm)
I think you are missing one closing bracket, let me know.function playerClass::setCurrentAnimation(%this, %yVelocity)
{
if(%yVelocity < 0 )
{
%this.playAnimation(playerJumpUp);
}
if(%yVelocity > 0 )
{
%this.playAnimation(playerJumpDown);
}
else if
{
if(%this.moveLeft || %this.moveRight)
{
if(%this.getAnimationName() $= "playerRun")
{
if(%this.getIsAnimationFinished())
{
%this.playAnimation(playerRun);
}
}
} <===== Right here ====================
else
{
%this.playAnimation(playerRun);
}
}
else
{
%this.playAnimation(playerStand);
}
}
#4
04/15/2014 (5:28 am)
It seemed to fix one issue now its saying another one is in play Wonderful.
#5
04/15/2014 (6:41 am)
Console output helps - please provide relevant errors from the console (not the whole thing) if you would like useful input on resolving your issue.
#6
04/15/2014 (7:58 am)
Anyway to copy that directly from the console?
#7
04/15/2014 (8:09 am)
sorry for the double browser gltich
#8
04/15/2014 (1:30 pm)
console.log file in your torque executable folder.
#9
function playerClass::setCurrentAnimation(%this, %yVelocity)
{
if(%yVelocity < 0 )
{
%this.playAnimation(playerJumpUp);
}
if(%yVelocity > 0 )
{
%this.playAnimation(playerJumpDown);
}
else if
{
if(%this.moveLeft || %this.moveRight)
{
if(%this.getAnimationName() $= "playerRun")
{
if(%this.getIsAnimationFinished())
{
%this.playAnimation(playerRun);
}
}
else
{
%this.playAnimation(playerRun);
}
}
} <===== Right here instead ====================
else
{
%this.playAnimation(playerStand);
}
}
04/15/2014 (6:37 pm)
I might have been off where the missing bracket should have went. I have made the correction below, regardless Richard is right we need more information to help you, let me know what this does.function playerClass::setCurrentAnimation(%this, %yVelocity)
{
if(%yVelocity < 0 )
{
%this.playAnimation(playerJumpUp);
}
if(%yVelocity > 0 )
{
%this.playAnimation(playerJumpDown);
}
else if
{
if(%this.moveLeft || %this.moveRight)
{
if(%this.getAnimationName() $= "playerRun")
{
if(%this.getIsAnimationFinished())
{
%this.playAnimation(playerRun);
}
}
else
{
%this.playAnimation(playerRun);
}
}
} <===== Right here instead ====================
else
{
%this.playAnimation(playerStand);
}
}
#10
Knight/game/gameScripts/player.cs Line: 111 - parse error
>>> Advanced script error report. Line 111.
>>> Some error context, with ## on sides of error halt:
^}
^$pGuy.setLinearVelocityX(%xVelocity);
}
function playerClass::setCurrentAnimation(%this, %yVelocity)
{
if(%yVelocity < 0 )
{
%this.playAnimation(playerJumpUp);
}
if(%yVelocity > 0 )
{
%this.playAnimation(playerJumpDown);
}
else if
{
##i##f(%this.moveLeft || %this.moveRight)
{
if(%this.getAnimationName() $= "playerRun")
{
if(%this.getIsAnimationFinished())
{
%this.playAnimation(playerRun);
}
}
else
{
%this.playAnimation(playerRun);
}
}
}
else
{
%this.playAnimation(playerStand);
>>> Error report complete.
04/16/2014 (7:48 am)
Made the changes suggested now I get Knight/game/gameScripts/player.cs Line: 111 - parse error
>>> Advanced script error report. Line 111.
>>> Some error context, with ## on sides of error halt:
^}
^$pGuy.setLinearVelocityX(%xVelocity);
}
function playerClass::setCurrentAnimation(%this, %yVelocity)
{
if(%yVelocity < 0 )
{
%this.playAnimation(playerJumpUp);
}
if(%yVelocity > 0 )
{
%this.playAnimation(playerJumpDown);
}
else if
{
##i##f(%this.moveLeft || %this.moveRight)
{
if(%this.getAnimationName() $= "playerRun")
{
if(%this.getIsAnimationFinished())
{
%this.playAnimation(playerRun);
}
}
else
{
%this.playAnimation(playerRun);
}
}
}
else
{
%this.playAnimation(playerStand);
>>> Error report complete.
#11
04/17/2014 (1:31 pm)
The else if statement needs a condition....}
else if // NFG
{
...
// --------------------
}
else if (%this.moveLeft || %this.moveRight) // now has a condition
{
...
#12
04/19/2014 (7:41 am)
Ive got my player movement working now thank you everyone for the help.
Employee Michael Perry
ZombieShortbus