Author Topic: Baffled by a syntax error  (Read 697 times)

Ok I am a novice at coding and I have a problem with a syntax error, please help.

Console:
Code: [Select]
Loading Add-On: Server_servermessage (CRC:1021897025)
Add-Ons/Server_servermessage/server.cs Line: 6 - Syntax error.
>>> Some error context, with ## on sides of error halt:
/FIBmods - Server_servermessage

//By Fluff-is-back

function serverCmdMessage(%client)

{

    messageClient(%client, '', $FIBMods::smessage)

}##
##
function serverCmdForceMessage(%client,%name)

{

      %target = %client;

   if(%client.isAdmin && %name !$= "")

      %target = FindClientByName(%name);

   if(isObject(%target))

   {

      messageClient(%client, 'MsgBoxOK', $FIBMods::smessage,);

   }
>>> Error report complete.

ADD-ON "Server_servermessage" CONTAINS SYNTAX ERRORS

Actual code:
Code: [Select]
//FIBmods - Server_servermessage
//By Fluff-is-back
function serverCmdMessage(%client)
{
    messageClient(%client, '', $FIBMods::smessage)
}
function serverCmdForceMessage(%client,%name)
{
      %target = %client;
   if(%client.isAdmin && %name !$= "")
      %target = FindClientByName(%name);
   if(isObject(%target))
   {
      messageClient(%client, 'MsgBoxOK', $FIBMods::smessage,);
   }
}
function serverCmdMessageAll(%client)
{
   if(%client.isAdmin)
  {
    BottomPrintAll($FIBMods::smessage,10)
  }
}
if(isFile("Add-Ons/System_ReturnToBlockland/server.cs"))
{
  if(!$RTB::RTBR_ServerControl_Hook)
    exec("Add-Ons/System_ReturnToBlockland/RTBR_ServerControl_Hook.cs");
    RTB_registerPref("Server Message","Server Message","$FIBMods::smessage","string 50","FIBMods",$FIBMods::smessage,0,0);
}



Missing a semicolon on the end of the messageClient line.

Missing a semicolon on the end of the messageClient line.
And this: BottomPrintAll($FIBMods::smessage,10)

Don't you hate it when you leave out a semicolon and spend hours trying to fix it when you could of just put one simple ; at the end of a line to make things all better?

Don't you hate it when you leave out a semicolon and spend hours trying to fix it when you could of just put one simple ; at the end of a line to make things all better?
YES

Don't you hate it when you leave out a semicolon and spend hours trying to fix it when you could of just put one simple ; at the end of a line to make things all better?
I know when I missed a semicolon when I look at the error.

My problem is when I do something like this:
Code: [Select]
function serverCmdDoCoolStuff(%client)
{
And for some stupid reason, I use %this to reference the client within the function.
Test it, and suddenly it's not working. No errors, just not happening. I rip apart the code that seems perfect and rewrite what should already work, and do this for about an hour.
Then... Oh... My bad. I did it wrong.

I always hate when something just plain doesn't work. It loads, no console errors, but doesn't work. That is why I put echos after the if statements for testing purposes.

I always hate when something just plain doesn't work. It loads, no console errors, but doesn't work. That is why I put echos after the if statements for testing purposes.
If your problem is anything like mine, it's probably just the wrong local var being used.

If your problem is anything like mine, it's probably just the wrong local var being used.
Mine usually involves using &. For example, when checking if the killer was a cop, the prisoner had over 20 "demerits" and the victim was a prisoner, I got all the != wrong, so I had to comment my thing so I remembered what I was checking.

I always hate when something just plain doesn't work. It loads, no console errors, but doesn't work. That is why I put echos after the if statements for testing purposes.
Code: (Weapon_FlashGrenade.cs) [Select]
//echo("Angle:"SPC %angle);
//echo("Start:"SPC %start);