Author Topic: Odd scripting error  (Read 1070 times)

Yeah while making special zombie proof bricks I got a special error.

Here is the error from console.


Code: [Select]
add-ons/rot/E-Bricks/1x1.cs Line: 32 - Syntax error.
>>> Advanced script error report.  Line 63.
>>> Some error context, with ## on sides of error halt:
   if(isObject(%obj.vehicleSpawnMarker))

    %obj.vehicleSpawnMarker.delete();



function ##b##rick1x1x3::onadd(%this,%brick)

{

^%brick.isunbreakable = 1;

}
>>> Error report complete.

Executing add-ons/rot/E-Bricks/1x1.cs.
add-ons/rot/E-Bricks/1x1.cs Line: 32 - Syntax error.
>>> Advanced script error report.  Line 63.
>>> Some error context, with ## on sides of error halt:
   if(isObject(%obj.vehicleSpawnMarker))

    %obj.vehicleSpawnMarker.delete();



function ##b##rick1x1x3::onadd(%this,%brick)

{

^%brick.isunbreakable = 1;

}
>>> Error report complete.

add-ons/rot/E-Bricks/1x2.cs Line: 33 - Syntax error.
>>> Advanced script error report.  Line 65.
>>> Some error context, with ## on sides of error halt:
   if(isObject(%obj.vehicleSpawnMarker))

    %obj.vehicleSpawnMarker.delete();



function ##b##rick1x1x3::onadd(%this,%brick)

{

^%brick.isunbreakable = 1;

}


>>> Error report complete.

Any idea on how to fix it?


Here is the .cs the error is talking about.

Code: [Select]
//1x1.cs
datablock fxDTSBrickData (brick1x1x3){
brickFile = "base/data/bricks/special/zp1x1.blb";
category = "Special";
subCategory = "Zombie";
uiName = "ZombieProof1x1";
iconName = "";
};
function brick1x1x3::onadd(%this,%brick)
{
%brick.isunbreakable = 1;
}

function brick1x1x3::onremove(%this,%brick)
{
//zombiecleanupbrick(%brick);
//simgroupfunc();
if(%brick.isplanted){
//ZombieSpawnGroup.remove(%brickj);
////echo(gotthisfar);
////echo(%this SPC %brick);

   if(isObject(%obj.light))
      %obj.light.delete();
   if(isObject(%obj.emitter))
      %obj.emitter.delete();
   if(isObject(%obj.item))
      %obj.item.delete();
   if(isObject(%obj.AudioEmitter))
      %obj.AudioEmitter.delete();
   if(isObject(%obj.vehicle))
      %obj.vehicle.delete();
   if(isObject(%obj.vehicleSpawnMarker))
    %obj.vehicleSpawnMarker.delete();

If the unbreakableness is to do with a local brick variable rather than a datablock-held one, wouldn't it be easier to add some sort of Indestructible Wand, for use on any brick? (As well as the Huge Unbreakable Wall)

You forgot a few } brackets, although the place the error is detected is a little strange. Have you accidentally cloned the brick1x1x3::onadd function? (Wouldn't make errors, but would explain the position of the ## ## in your script)

Code: [Select]
//1x1.cs
datablock fxDTSBrickData (brick1x1x3){
brickFile = "base/data/bricks/special/zp1x1.blb";
category = "Special";
subCategory = "Zombie";
uiName = "ZombieProof1x1";
iconName = "";
};
function brick1x1x3::onadd(%this,%brick)
{
%brick.isunbreakable = 1;
}

function brick1x1x3::onremove(%this,%brick)
{
 //zombiecleanupbrick(%brick);
 //simgroupfunc();
 //ZombieSpawnGroup.remove(%brickj);
 ////echo(gotthisfar);
 ////echo(%this SPC %brick);

 if(%brick.isplanted)
 {
   if(isObject(%obj.light))
      %obj.light.delete();
   if(isObject(%obj.emitter))
      %obj.emitter.delete();
   if(isObject(%obj.item))
      %obj.item.delete();
   if(isObject(%obj.AudioEmitter))
      %obj.AudioEmitter.delete();
   if(isObject(%obj.vehicle))
      %obj.vehicle.delete();
   if(isObject(%obj.vehicleSpawnMarker))
    %obj.vehicleSpawnMarker.delete();
 }
}