211
Modification Help / Function is being fickle - Raycasts
« on: December 05, 2012, 03:47:10 AM »
Okay, so I don't know what it is, but it appears to just not like something, namely the absence of something after the }; mark.
Here is my original function:
Here is the error report:
Correct me if I'm wrong, but it looks like it doesn't like something that isn't there, maybe it doesn't like the enter. Any variation with the semicolon seems to fail. The "symptom" is that when switching to the Loading Datablocks phase, Blockland crashes.
Here is my original function:
Code: [Select]
function leviathanImage::onFire(%this, %obj, %slot)
{
if(%obj.lastShot[%this] + %this.minShotTime > getSimTime())
{
return;
}
%obj.lastShot[%this] = getSimTime();
%start = %obj.getMuzzlePoint(%slot);
%end = vectorAdd(%start, vectorScale(%obj.getMuzzleVector(%slot), 500));
%typemasks = $Typemasks::PlayerObjectType | $Typemasks::FxBrickObjectType | $Typemasks::TerrainObjectType | $Typemasks::InteriorObjectType | $TypeMasks::StaticObjectType | $TypeMasks::VehicleObjectType;
%ray = containerRaycast(%start, %end, %typemasks, %obj);
if(isObject(%hit = firstWord(%ray)))
{
%pos = posFromRaycast(%ray);
%apos = vectorAdd(%pos, vectorScale(normalFromRaycast(%ray), 0.05));
%prj = new Projectile()
{
datablock = LeviathanProjectile;
initialPosition = %apos;
initialVelocity = vectorScale(%obj.getMuzzleVector(%slot), 200);
scale = %obj.getScale();
sourceObject = %obj;
sourceSlot = %slot;
client = %obj.client;
Leviathanbullet = true;
};
}
};Here is the error report:
Code: [Select]
Loading Add-On: Weapon_Leviathan (CRC:327213675)
Add-Ons/Weapon_Leviathan/server.cs Line: 462 - Syntax error.
>>> Some error context, with ## on sides of error halt:
^^%apos = vectorAdd(%pos, vectorScale(normalFromRaycast(%ray), 0.05));
^^%prj = new Projectile()
^^{
^^^datablock = LeviathanEmitterA;
^^^initialPosition = %apos;
^^^initialVelocity = "0 0 0";
^^^scale = %obj.getScale();
^^^sourceObject = %obj;
^^^sourceSlot = %slot;
^^^client = %obj.client;
^^};
^}
};##
##
function leviathanImage::onFire(%this, %obj, %slot)
{
^if(%obj.lastShot[%this] + %this.minShotTime > getSimTime())
^{
^^return;
^}
^%obj.lastShot[%this] = getSimTime();
^%start = %obj.getMuzzlePoint(%slot);
^%end = vectorAdd(%start, vectorScale(%obj.getMuzzleVector(%slot), 500));
>>> Error report complete.
ADD-ON "Weapon_Leviathan" CONTAINS SYNTAX ERRORSCorrect me if I'm wrong, but it looks like it doesn't like something that isn't there, maybe it doesn't like the enter. Any variation with the semicolon seems to fail. The "symptom" is that when switching to the Loading Datablocks phase, Blockland crashes.

