Author Topic: Unknown Syntax Error  (Read 614 times)

I've been working on my newest weapon (The Type-25 Directed Energy Rifle), and there seems to be a syntax error in my script. According to the console, it says its on line 398 and pretty much highlights the first letter in the weaponImage name and nothing else. Me and a friend have been trying to fix it, but we cant seem to find the issue.

Pic of console error report:


Suspected code (lines 319-455 in the script)
Code: [Select]
//Weapon States
stateName[0]                     = "Activate";
stateTimeoutValue[0]             = 0.73;
stateTransitionOnTimeout[0]       = "Ready";
stateScript[0] = onReady;
stateSound[0] = Type25DERUseSound;
stateSequence[0] = "use";

stateName[1]                     = "Ready";
stateTransitionOnNoAmmo[1]       = "Cool";
stateTransitionOnTriggerDown[1]   = "Fire";
stateAllowImageChange[1]         = true;

stateName[2]                     = "Fire";
stateTransitionOnTimeout[2]     = "Delay1";
stateTimeoutValue[2]             = 0.06;
stateFire[2]                     = true;
stateAllowImageChange[2]         = false;
stateSequence[2]                 = "fire1";
stateScript[2]                   = "onFire";
stateEjectShell[2]         = true;
stateEmitter[2] = Type25DERFlashEmitter;
stateEmitterTime[2] = 0.01;
stateEmitterNode[2] = "muzzleNode";
stateWaitForTimeout[2] = true;

stateName[3] = "Delay1";
stateTransitionOnTimeout[3]     = "Fire2";
stateTimeoutValue[3]             = 0.01;

stateName[4]                     = "Fire2";
stateTransitionOnTimeout[4]     = "Delay2";
stateTimeoutValue[4]             = 0.06;
stateFire[4]                     = true;
stateAllowImageChange[4]         = false;
stateSequence[4]                 = "fire2";
stateScript[4]                   = "onFire";
stateEjectShell[4]         = true;
stateEmitter[4] = Type25DERFlashEmitter;
stateEmitterTime[4] = 0.01;
stateEmitterNode[4] = "muzzleNode";
stateWaitForTimeout[4] = true;

stateName[5] = "Delay2";
stateTransitionOnTimeout[5]     = "heatCheck";
stateTimeoutValue[5]             = 0.01;

stateName[6] = "heatCheck";
stateTimeoutValue[6] = 0.01;
stateTransitionOnTimeout[6] = "Finish";

stateName[7] = "Finish";
stateTransitionOnTimeout[7]     = "Ready";
stateTimeoutValue[7]            = 0.00001;

stateName[8] = "Vent";
stateTimeoutValue[8] = 0;
stateTransitionOnTimeout[8] = "Cool";
stateWaitForTimeout[8] = false;
stateEmitter[8] = plasmaSteamEmitter;
stateEmitterTime[8] = 0.95;
stateEmitterNode[8] = "lVentCover";

stateName[9] = "Cool";
stateTimeoutValue[9] = 1.25;
stateTransitionOnTimeout[9] = "Wait";
stateWaitForTimeout[9] = true;
stateSequence[9] = "overHeat";
stateSound[9] = Type25DERCoolSound;
stateEmitter[9] = plasmaSteamEmitter;
stateEmitterTime[9] = 0.95;
stateEmitterNode[9] = "rVentCover";





//Weapon Functions

function Type25DERImage::onFire(%this,%obj,%slot)
{

   %pos = %obj.getTransform();
   %random = getRandom(1,3);
   switch(%random)
   {
      case 1:
         serverplay3d(Type25DERFire1Sound,%pos);
      case 2:
         serverplay3d(Type25DERFire2Sound,%pos);
      case 3:
         serverplay3d(Type25DERFire3Sound,%pos);
      default:
         echo("Error on Plasma Rifle");
   }

  
%projectile = Type25DERProjectile;

if(vectorLen(%obj.getVelocity()) < 0.1)
{
%spread = 0.006;
}
else
{
%spread = 0.005;
}

%obj.lastShotTime = getSimTime();
%shellcount = 1;
       
%shellcount = 1;
%obj.toolAmmo[%obj.currTool]--;


for(%shell=0; %shell<%shellcount; %shell++)
{
%vector = %obj.getMuzzleVector(%slot);
%objectVelocity = %obj.getVelocity();
%vector1 = VectorScale(%vector, %projectile.muzzleVelocity);
%vector2 = VectorScale(%objectVelocity, %projectile.velInheritFactor);
%velocity = VectorAdd(%vector1,%vector2);
%x = (getRandom() - 0.5) * 10 * 3.1415926 * %spread;
%y = (getRandom() - 0.5) * 10 * 3.1415926 * %spread;
%z = (getRandom() - 0.5) * 10 * 3.1415926 * %spread;
%mat = MatrixCreateFromEuler(%x @ " " @ %y @ " " @ %z);
%velocity = MatrixMulVector(%mat, %velocity);

%p = new (%this.projectileType)()
{
dataBlock = %projectile;
initialVelocity = %velocity;
initialPosition = %obj.getMuzzlePoint(%slot);
sourceObject = %obj;
sourceSlot = %slot;
client = %obj.client;
};
MissionCleanup.add(%p);
}
return %p;
}
« Last Edit: October 23, 2011, 12:46:25 PM by Midway Sentinel »

You didn't put any of the stats with in a datablock. What are you learning off of to make scripts? Not to be mean, I want to know, because it might be a flawed source.

everything is either borrowed from other scripts, or my attempt at scripting. most of the stuff i make is self taught cause i don't know where to learn

edit: i found the issue. i was missing the }; at the end of the states section
« Last Edit: October 23, 2011, 02:21:07 PM by Midway Sentinel »