Game Development Community

Chapter 6: Dedicated Server Syntax Error

by Zachary Perschall · in Torque Game Engine · 07/28/2004 (7:40 pm) · 6 replies

I'm hoping that this is something simple, but I am having a funky error when I fire up TGE in dedicated mode.

Debugging reports this:
Compiling control/server/weapons/crossbow.cs...
control/server/weapons/crossbow.cs Line: 294 - Syntax error.
>>> Advanced script error report.  Line 587.
>>> Some error context, with ## on sides of error halt:
^^VectorScale(%objectVelocity, %projectile.velInheritFactor));
^%p = new (%this.projectileType() {##
##
^^dataBlock^^^= %projectile;
^^initialVelocity ^= %muzzleVelocity;
>>> Error report complete.

Here is the section of code it is complaining about:
function CrossbowImage::onFire(%this,%obj,%slot)
{
	%projectile = %this.projectile;
	%obj.decInventory(%this.ammo,1);
	%muzzleVector = %obj.getMuzzleVector(%slot);
	%objectVelocity = %obj.getVelocity();
	%muzzleVelocity = VectorAdd(
		VectorScale(%muzzleVector, %projectile.muzzleVelocity),
		VectorScale(%objectVelocity, %projectile.velInheritFactor));
	%p = new (%this.projectileType() {
		dataBlock			= %projectile;
		initialVelocity 	= %muzzleVelocity;
		initialPosition	= %obj.getMuzzlePoint(%slot);
		sourceObject		= %obj;
		sourceSlot			= %slot;
		client				= %obj.client;
	};
	MissionCleanup.add(%p);
	return %p;
}

I figured maybe I've been staring at code too long and am missing the obvious, but it looks like a formatting issue?

Thanks!!

#1
07/28/2004 (8:38 pm)
Client = %obj.client;
};(<--------------dont think this should be here.. ie the ;)
MissionCleanup.add(%p);
return %p;
}
#2
07/28/2004 (8:46 pm)
Try this...
function CrossbowImage::onFire(%this,%obj,%slot)
    {   
        %projectile = %this.projectile;   
        %obj.decInventory(%this.ammo,1);   
        %muzzleVector = %obj.getMuzzleVector(%slot);   
        %objectVelocity = %obj.getVelocity();   
        %muzzleVelocity = VectorAdd(      
               VectorScale(%muzzleVector, %projectile.muzzleVelocity),                                    VectorScale(%objectVelocity, %projectile.velInheritFactor));   
            %p = new (%this.projectileType() {      
                 dataBlock         = %projectile;      
                 initialVelocity    = %muzzleVelocity;      
                 initialPosition   = %obj.getMuzzlePoint(%slot);      
                 sourceObject      = %obj;      
                 sourceSlot         = %slot;      
                 client            = %obj.client;   
           }   
      MissionCleanup.add(%p);   
      return %p;
}

removed the ;
#3
07/28/2004 (11:49 pm)
Actually, it looks like this :
%p = new (%this.projectileType() {

Should be :
%p = new (%this.projectileType()) {
#4
07/29/2004 (4:45 am)
Thanks for the fresh eyes, James.....I knew it was something simple I was overlooking. After 8 hours of looking at code all day, it all kind of blurs together.

8-)

-Zach
#5
07/29/2004 (5:48 am)
Oops, didnt have my book handy.. :)

need to rememeber to have that book here by the comp.. :)
#6
07/29/2004 (9:04 am)
Zachary, if you get this to work, would you please post the complete working Chapter 6 code as a resource? You and I are definitely not the only people having problems with this code - the author acknowledged problems with the code but hasn't posted any corrections yet, and it looks like it will be a while until he does. It would really move one of my current projects along. Thanks!