Author Topic: Getting syntax error for reason I dont know  (Read 824 times)

I'm making an airhorn addon that just plays an airhorn sound. I'm not good with scripts at all and I really need help.

I basically copied the gun code and removed everything that involved the actual "gun" (like shooting and stuff) and i keep getting a syntax error for a stateSequence in the 3rd state

When I go to start my game/execute the server.cs, this happens



also heres the code to my item

Code: [Select]
//Airhorn.cs
 
//audio
datablock AudioProfile(AirhornBlastSound)
{
   filename    = "./AirhornBlast.wav";
   description = AudioClose3d;
   preload = true;
};
 
//////////
// item //
//////////
datablock ItemData(AirhornItem)
{
        category = "Item";  // Mission editor category
        className = "Weapon"; // For inventory system
 
         // Basic Item Properties
        shapeFile = "./Airhorn.dts";
        rotate = false;
        mass = 1;
        density = 0.2;
        elasticity = 0.2;
        friction = 0.6;
        emap = true;
 
        //gui stuff
        uiName = "Gun";
        iconName = "./Icon_Airhorn";
        doColorShift = true;
        colorShiftColor = "0.25 0.25 0.25 1.000";
 
         // Dynamic properties defined by the scripts
        image = AirHornImage;
        canDrop = true;
};
 
////////////////
//weapon image//
////////////////
datablock ShapeBaseImageData(AirhornImage)
{
   // Basic Item properties
   shapeFile = "./Airhorn.dts";
   emap = true;
 
   // Specify mount point & offset for 3rd person, and eye offset
   // for first person rendering.
   mountPoint = 0;
   offset = "0 0 0";
   eyeOffset = 0; //"0.7 1.2 -0.5";
   rotation = eulerToMatrix( "0 0 0" );
 
   // When firing from a point offset from the eye, muzzle correction
   // will adjust the muzzle vector to point to the eye LOS point.
   // Since this weapon doesn't actually fire from the muzzle point,
   // we need to turn this off.  
   correctMuzzleVector = false;
 
   // Add the WeaponImage namespace as a parent, WeaponImage namespace
   // provides some hooks into the inventory system.
   className = "WeaponImage";
 
 
 
   //melee particles shoot from eye node for consistancy
   melee = false;
   //raise your arm up or not
   armReady = true;
 
   doColorShift = false;
   //casing = " ";
 
   // Images have a state system which controls how the animations
   // are run, which sounds are played, script callbacks, etc. This
   // state system is downloaded to the client so that clients can
   // predict state changes and animate accordingly.  The following
   // system supports basic ready->fire->reload transitions as
   // well as a no-ammo->dryfire idle state.
 
   // Initial start up state
        stateName[0]                     = "Activate";
        stateTimeoutValue[0]             = 0.15;
        stateTransitionOnTimeout[0]      = "Ready";
        stateSound[0]     = weaponSwitchSound;
 
        stateName[1]                     = "Ready";
        stateTransitionOnTriggerDown[1]  = "Fire";
        stateAllowImageChange[1]         = true;
        stateSequence[1] = "Ready";
 
        stateName[2]                    = "Fire";
        stateTransitionOnTimeout[2]     = "Reload";
        stateTimeoutValue[2]            = 0.14;
        stateFire[2]                    = true;
        stateAllowImageChange[2]        = false;
        stateSequence[2]                = "Fire";
        stateScript[2]                  = "onFire";
        stateWaitForTimeout[2]   = true;
        stateSound[2]     = AirhornBlastSound;
 
        stateName[3]                    = "Reload";
        stateSequence[3]                = "Reload";
        stateTransitionOnTriggerUp[3]   = "Ready";
        stateSequence[3]                = "Ready";

You need a closing bracket.

lol thanks, syntax error is gone but the item still doesn't show up in item list. am i forgetting something?

The uiName is "gun" which probably already exists. There might be two copies of "gun" in the list though, one of which will be your airhorn.

The uiName is "gun" which probably already exists. There might be two copies of "gun" in the list though, one of which will be your airhorn.
actually noticed that right before you said something

but there is actually still a syntax error on server launch (but not when i execute it)




i managed to fix this (i put a semicollon on the last bracket), there are other errors i can probably fix but if i cant ill ask
« Last Edit: January 03, 2015, 11:12:05 PM by Trogtor »