Author Topic: Syntax Error(s)  (Read 1132 times)

Here is the console.log error:
Code: [Select]
Loading Add-On: Gamemode_Mining
Add-Ons/Gamemode_Mining/server.cs Line: 19 - Syntax error.
>>> Some error context, with ## on sides of error halt:
$Dig_valueMin["silver"] = 60;
$Dig_ValueMin["uran"] = 500;

function servercmdstartDig(%client)
{
    if(%client.bl_id != getNumKeyID() && findLocalClient() != %client)
    {
^messageClient(%client, '', "You are not the host so you cannot start dig mode");
^return;
    }

 �## ##�$Dig_allowedMission["Slate"] = 1;
 � �$Dig_allowedMission["Slate Aurora"] = 1;
 � �$Dig_allowedMission["Destruct"] = 1;
 � �$Dig_groundID["Slate"] = 5;
 � �$Dig_groundID["Slate Aurora"] = 6;
 � �$Dig_groundID["Destruct"] = 5;

 � �if(!$Dig_allowedMission[missionInfo.name])
>>> Error report complete.

ADD-ON "Gamemode_Mining" CONTAINS SYNTAX ERRORS


The Original Script

Code: [Select]
$Dig_valueMin["silver"] = 60;
$Dig_ValueMin["uran"] = 500;

function servercmdstartDig(%client)
{
    if(%client.bl_id != getNumKeyID() && findLocalClient() != %client)
    {
messageClient(%client, '', "You are not the host so you cannot start dig mode");
return;
    }

    $Dig_allowedMission["Slate"] = 1;
    $Dig_allowedMission["Slate Aurora"] = 1;
    $Dig_allowedMission["Destruct"] = 1;
    $Dig_groundID["Slate"] = 5;
    $Dig_groundID["Slate Aurora"] = 6;
    $Dig_groundID["Destruct"] = 5;

    if(!$Dig_allowedMission[missionInfo.name])

Then we are back to the second problem.
« Last Edit: April 23, 2010, 08:42:09 PM by Butler »

Line 14, find it for us.

In the server.cs of GameMode_Mining


im not sure either -- but you can try this:

Code: [Select]
    if(%client.bl_id != getNumKeyID() && findLocalClient() != %client)
    {
messageClient(%client, '', "You are not the host so you cannot start dig mode");
return;
    }

If that's the entire script, add another } after the other }.

If that's the entire script, add another } after the other }.

I OBVIOUSLY didn't post the entire script, as there was no need to. The syntax error is in the section i posted.

I just posted a new problem.


Code: [Select]
$Dig_valueMin["silver"] = 60;
$Dig_ValueMin["uran"] = 500;

function servercmdstartDig(%client)
{
    if(%client.bl_id != getNumKeyID() && findLocalClient() != %client)
    {
messageClient(%client, '', "You are not the host so you cannot start dig mode");
return;
    }
}

    $Dig_allowedMission["Slate"] = 1;
    $Dig_allowedMission["Slate Aurora"] = 1;
    $Dig_allowedMission["Destruct"] = 1;
    $Dig_groundID["Slate"] = 5;
    $Dig_groundID["Slate Aurora"] = 6;
    $Dig_groundID["Destruct"] = 5;

    if(!$Dig_allowedMission[missionInfo.name])

The first problem is solved thanks to "Red_Guy". Now... there is a second probem.

This?


Then don't I need an opening one?

Code: [Select]
$Dig_valueMin["silver"] = 60;
$Dig_ValueMin["uran"] = 500;

function servercmdstartDig(%client)
{
    if(%client.bl_id != getNumKeyID() && findLocalClient() != %client)
    {
messageClient(%client, '', "You are not the host so you cannot start dig mode");
return;
    }
}

{
    $Dig_allowedMission["Slate"] = 1;
    $Dig_allowedMission["Slate Aurora"] = 1;
    $Dig_allowedMission["Destruct"] = 1;
    $Dig_groundID["Slate"] = 5;
    $Dig_groundID["Slate Aurora"] = 6;
    $Dig_groundID["Destruct"] = 5;

    if(!$Dig_allowedMission[missionInfo.name])

The first problem is solved thanks to "Red_Guy". Now... there is a second probem.

Like this?


Ok, but I have it close here like you said:

function servercmdstartDig(%client)
{
    if(%client.bl_id != getNumKeyID() && findLocalClient() != %client)
    {
   messageClient(%client, '', "You are not the host so you cannot start dig mode");
   return;
    }
} <== Here is the closing one you told me to write.

    $Dig_allowedMission["Slate"] = 1;
    $Dig_allowedMission["Slate Aurora"] = 1;
    $Dig_allowedMission["Destruct"] = 1;
    $Dig_groundID["Slate"] = 5;
    $Dig_groundID["Slate Aurora"] = 6;
    $Dig_groundID["Destruct"] = 5;

    if(!$Dig_allowedMission[missionInfo.name])
    {
   messageClient(%client, '', "Dig mode is only usable in Slate, Slate Aurora, and Destruct");
   return;
    }

    $Dig_host = %client;
    $Dig_host_brickgroup = %client.brickgroup;
    $Dig_host_id = %client.bl_id;
    deleteVariables("$Dig_placedDirt*");
    %ground = missionGroup.getobject($Dig_groundID[missionInfo.name]);
    if(missionInfo.name $= "Slate Aurora")
   %water = missionGroup.getobject(7);

    if(isObject(%ground))
   %ground.delete();

    if(isObject(%water))
   %water.delete();

    %spawnsphere = playerDropPoints.getobject(0);
    %spawnsphere.radius = 5;
    %spawnsphere.RayHeight = 3;

    messageAll('', "<color:00FF00>Dig mode is now enabled");

    for(%x = -5.5; %x <= 5.5; %x++)
   for(%y = -5.5; %y <= 5.5; %y++)
   {
       Dig_PlaceCement(%x*2 SPC %y*2 SPC 0, "brick4xCubeData");
       Dig_PlaceCement(%x*2 SPC %y*2 SPC 10, "brick4xCubeData");
   }

    %pos[0] = "10 10";
    %pos[1] = "10 -10";
    %pos[2] = "-10 10";
    %pos[3] = "-10 -10";

    for(%a = 0; %a < 4; %a++)
    {
   Dig_PlaceCement(%pos[%a] SPC 3, "brick8xCubeData");
   Dig_PlaceCement(%pos[%a] SPC 7, "brick8xCubeData");
    }

    for(%z = 0; %z <= 3; %z++)
    {
   for(%x = 0; %x < 8; %x++)
       Dig_PlaceDirt(-7 + %x*2 SPC 11 SPC 2+%z*2);

   for(%y = 0; %y < 8; %y++)
       Dig_PlaceDirt(11 SPC 7 - %y*2 SPC 2+%z*2);

   for(%x = 0; %x < 8; %x++)
       Dig_PlaceDirt(7 - %x*2 SPC -11 SPC 2+%z*2);

   for(%y = 0; %y < 8; %y++)
       Dig_PlaceDirt(-11 SPC -7 + %Y*2 SPC 2+%z*2);
    }

    %light = Dig_PlaceCement("0 0 8.75", "brick2x2FRoundData");
    %light.setLight(PlayerLight);

    activatepackage(Dig_spawnPackage);
    for(%c = 0; %c < ClientGroup.getCount(); %c++)
   if(ClientGroup.getObject(%c).hasSpawnedOnce)
       ClientGroup.getObject(%c).instantRespawn();

    Dig_announceStats();
    $Dig_on = 1;
} <== Then, here is another closing one.

This is why it helps when you give us the whole code.
Get rid of the first one I told you to put in.


function servercmdstartDig(%client)
{
    if(%client.bl_id != getNumKeyID() && findLocalClient() != %client)
    {
   messageClient(%client, '', "You are not the host so you cannot start dig mode");
   return;
    }
} <== So get rid of this one?

    $Dig_allowedMission["Slate"] = 1;
    $Dig_allowedMission["Slate Aurora"] = 1;
    $Dig_allowedMission["Destruct"] = 1;
    $Dig_groundID["Slate"] = 5;
    $Dig_groundID["Slate Aurora"] = 6;
    $Dig_groundID["Destruct"] = 5;

    if(!$Dig_allowedMission[missionInfo.name])
    {
   messageClient(%client, '', "Dig mode is only usable in Slate, Slate Aurora, and Destruct");
   return;
    }

    $Dig_host = %client;
    $Dig_host_brickgroup = %client.brickgroup;
    $Dig_host_id = %client.bl_id;
    deleteVariables("$Dig_placedDirt*");
    %ground = missionGroup.getobject($Dig_groundID[missionInfo.name]);
    if(missionInfo.name $= "Slate Aurora")
   %water = missionGroup.getobject(7);

    if(isObject(%ground))
   %ground.delete();

    if(isObject(%water))
   %water.delete();

    %spawnsphere = playerDropPoints.getobject(0);
    %spawnsphere.radius = 5;
    %spawnsphere.RayHeight = 3;

    messageAll('', "<color:00FF00>Dig mode is now enabled");

    for(%x = -5.5; %x <= 5.5; %x++)
   for(%y = -5.5; %y <= 5.5; %y++)
   {
       Dig_PlaceCement(%x*2 SPC %y*2 SPC 0, "brick4xCubeData");
       Dig_PlaceCement(%x*2 SPC %y*2 SPC 10, "brick4xCubeData");
   }

    %pos[0] = "10 10";
    %pos[1] = "10 -10";
    %pos[2] = "-10 10";
    %pos[3] = "-10 -10";

    for(%a = 0; %a < 4; %a++)
    {
   Dig_PlaceCement(%pos[%a] SPC 3, "brick8xCubeData");
   Dig_PlaceCement(%pos[%a] SPC 7, "brick8xCubeData");
    }

    for(%z = 0; %z <= 3; %z++)
    {
   for(%x = 0; %x < 8; %x++)
       Dig_PlaceDirt(-7 + %x*2 SPC 11 SPC 2+%z*2);

   for(%y = 0; %y < 8; %y++)
       Dig_PlaceDirt(11 SPC 7 - %y*2 SPC 2+%z*2);

   for(%x = 0; %x < 8; %x++)
       Dig_PlaceDirt(7 - %x*2 SPC -11 SPC 2+%z*2);

   for(%y = 0; %y < 8; %y++)
       Dig_PlaceDirt(-11 SPC -7 + %Y*2 SPC 2+%z*2);
    }

    %light = Dig_PlaceCement("0 0 8.75", "brick2x2FRoundData");
    %light.setLight(PlayerLight);

    activatepackage(Dig_spawnPackage);
    for(%c = 0; %c < ClientGroup.getCount(); %c++)
   if(ClientGroup.getObject(%c).hasSpawnedOnce)
       ClientGroup.getObject(%c).instantRespawn();

    Dig_announceStats();
    $Dig_on = 1;
}