Author Topic: Syntax Error: wtf?  (Read 720 times)

Find waldo the syntax error!

Code: [Select]
add-ons/gamemode_desert/server.cs Line: 35 - Syntax error.
>>> Some error context, with ## on sides of error halt:

^while(%i < clientGroup.getCount())
^{
^^%client = clientgroup.getobject(%i);
^^
^^commandToClient(%client, 'bottomPrint', "\c3Thirst: \c6" @ %client.thirst @ " \c3Hunger: \c6" @ %client.hunger, 1);
^^
^^%i++;
^}
}
function needs()
{
^while(%i < clientGroup.getCount();##)##
^{
^^%client = clientgroup.getobject(%i);
^^
^^if(%client.thirst <= 0 || %client.hunger <= 0)
^^{
^^^%client.player.kill();
^^}
^^else
^^{
^^^%client.thirst--;
^^^%client.hunger--;
^^}
^^
^^%i++;
^}
}

Don't know much TorqueScript, but try removing the parentheses surrounded by ##
Change:
Code: [Select]
^while(%i < clientGroup.getCount();)To:
Code: [Select]
^while(%i < clientGroup.getCount();

Uh, no...

Take away the semicolon. That signals the end of a statement, which is not what you want inside the while().

nvm I died
BTW Dusty, you forgot to close the statement ;D
« Last Edit: December 30, 2009, 11:00:40 AM by ZSNO »

Code: [Select]
>>> Some error context, with ## on sides of error halt:Hmmm, maybe the syntax error is surrounded by ##s!

hurr my bad, ima fix that as soon as I get back to my computer

thanks

The forget.

Code: [Select]
Loading Add-On: Gamemode_Desert (CRC:734781342)
Add-Ons/Gamemode_Desert/server.cs Line: 87 - Syntax error.
>>> Some error context, with ## on sides of error halt:
^^needsTick();
^^$needs = 1;
^}
^else
^{
^^$needs = 0;
^}
}
package Desert
{
^function GameConnection::OnDeath(%this, %sourceObject, %sourceClient, %damageType, %damLoc)
^{
^^%this.thirst = 100;
^^%this.hunger = 100;
^}
}
activatePackage(##D##esert);
>>> Error report complete.

ADD-ON "Gamemode_Desert" CONTAINS SYNTAX ERRORS

Hint: how do packages end?

ofck

thanks, I always forget the ; after datablocks and packages and st00f