Author Topic: onPlant and onRemove errors?  (Read 760 times)

I took a piece from Space Guy's TDM code that makes triggers on bricks. Whenever I plant or remove a brick, I get one of these errors:
Code: [Select]
Add-Ons/Server_VW_Extension/capturepoints.cs (114): Unknown command onPlant.
Add-Ons/Server_VW_Extension/capturepoints.cs (129): Unknown command onRemove.

I have no idea what's wrong since everything works, the only problem is that it gives an error. Here are the functions it refers to:
Code: [Select]
function fxDTSBrick::onPlant(%this)
    {
    Parent::onPlant(%this);
    if(%this.dataBlock.isVWCapturePoint)
        {
        %this.createTriggerZone(VWcontrolTriggerData);
        }
    }
function fxDTSBrick::onRemove(%this)
    {
    if(%this.dataBlock.isVWCapturePoint)
        {
        if(isObject(%this.triggerZone))
            {
            %this.triggerZone.delete();
            }
        }   
    Parent::onRemove(%this);
    }

No, I have not packaged these because whenever I package them, it returns a random syntax error.

No, I have not packaged these because whenever I package them, it returns a random syntax error.
did you did this:
packge asdf { };


Show us the whole package code.

Code: [Select]
function fxDTSBrick::onPlant(%this)
    {
    Parent::onPlant(%this);
    if(%this.dataBlock.isVWCapturePoint)
        {
        %this.createTriggerZone(VWcontrolTriggerData);
        }
    }
function fxDTSBrick::onRemove(%this)
    {
    if(%this.dataBlock.isVWCapturePoint)
        {
        if(isObject(%this.triggerZone))
            {
            %this.triggerZone.delete();
            }
        }   
    Parent::onRemove(%this);
    }
function fxDTSBrick::createTriggerZone(%brick,%triggerData)
    {
    if(!isObject(%triggerData))
        {
        error("ERROR: Trigger data \"" @ %triggerData @ "\" does not exist for " @ %this.dataBlock.getName() @ " brick!");
        return;
        }
        if(%triggerData.getClassName() !$= "TriggerData")
            {
            error("ERROR: \"" @ %triggerData @ "\" is not a TriggerData datablock!");
            return;
            }       
        %t = new Trigger()
            {
            dataBlock = %triggerData;
            polyhedron = "0 0 0 1 0 0 0 -1 0 0 0 1";
            };
        if(!isObject(%t))
            {
            error("ERROR: Could not create trigger for " @ %this.dataBlock.getName() @ " brick!");
            return;
            }
        missionCleanup.add(%t);
       
        //The trigger is made slightly larger than the brick and offset
        %boxMin = getWords(%brick.getWorldBox(), 0, 2);
        %boxMax = getWords(%brick.getWorldBox(), 3, 5);
        %boxDiff = vectorSub(%boxMax, %boxMin);
        %boxDiff = vectorAdd(%boxDiff, "0 0 0.2");
        %t.setScale(%boxDiff);
       
        %posA = %brick.getWorldBoxCenter();
        %posB = %t.getWorldBoxCenter();
        %posDiff = vectorSub(%posA, %posB);
        %posDiff = vectorAdd(%posDiff, "0 0 0.1");
        %t.setTransform(%posDiff);
       
        %this.triggerZone = %t;
        %t.spawnBrick = %brick;
    }

He means including the package asdf {}; stuff

You mean how I packaged it? Same way everyone does:
Code: [Select]
Package VWCapPoints
{
//stuff up there here
};
activatepackage(VWCapPoints);

Not sure if it makes a difference, but try not capitalizing package

That makes no difference. I tried a couple days ago. Very frustrating, not being able to make a package...

Then you're obviously doing something wrong.
Post the error.

Here you go:
Code: [Select]
Add-Ons/Server_VW_Extension/capturepoints.cs Line: 113 - Syntax error.
>>> Some error context, with ## on sides of error halt:
^^bottomprint(%client,"<just:center>\c3Capture \c6: <just:left>\c0||||||||||||||||||||",1);

^^}

^if(%client.team == 2 && %brick.control == 2)

^^{

^^bottomprint(%client,"<just:center>\c3Capture \c6: <just:left>\c1||||||||||||||||||||",1);

^^}

^}



Package VWCapPoints
##
##{

function fxDTSBrick::onPlant(%this)

^{

^Parent::onPlant(%this);

^if(%this.dataBlock.isVWCapturePoint)

^^{

^^%this.createTriggerZone(VWcontrolTriggerData);

^^}

^}

function fxDTSBrick::onRemove(%this)

^{

^if(%this.dataBlock.isVWCapturePoint)

^^{
>>> Error report complete.

ADD-ON "Server_VW_Extension" CONTAINS SYNTAX ERRORS

Thanks for the help so far

Yeah I just did a quick test in BL, capitalizing package caused an error while not capitalizing it didn't.
Remove the capital and post the error again.

Not sure if it makes a difference, but try not capitalizing package

O, sorry, I misunderstood you- I though you meant capitalize it in activatepackage. Thanks! resolved in about 10 minutes. That worked, probably one of BL's dumbest syntax errors ever...

Locking
« Last Edit: September 22, 2010, 10:39:07 PM by Greek2me »