Game Development Community

TGE won't make logoitem.dso

by Donald McMullen · in Torque Game Engine · 03/30/2008 (10:28 pm) · 6 replies

Hi guys!

I still working with the gettingstarted.pdf,

I got my start button to work last night, but now the engine refuses to build a .dso file for the recently edited logoitem.cs.

here is a chunk of script from game.cs in the server folder:


function onServerCreated()
{
// This function is called when a server is constructed.

// Master server information for multiplayer games
$Server::GameType = "Torque TTB";
$Server::MissionType = "None";

// Load up all datablocks, objects etc.
exec("./logoitem.cs");
exec("./camera.cs");
exec("./editor.cs");
exec("./player.cs");

}

function onServerDestroyed()
{
// This function is called as part of a server shutdown.
}

I have tried deleting all of the .dso files in the sever folder so TGE will compile new ones (thus forcing an update yes?) I makes all of the .dsos cep logoitem.dso.

Is there something wrong with my script that might prevent it from compiling a new .dso file so it will make my logos vanish when I touch them?

BTW: my server folder has .dso's for every other .cs cep logoitem.cs

#1
03/30/2008 (10:31 pm)
You'll need to show us the logoitem.cs, which is what isn't compiling.

However, first look at your console.log--if there is a compilation error, it will list it, and the approximate place of the error.
#2
03/30/2008 (10:46 pm)
Here you go!

/-----------------------------------------------------------------------------
// Torque Game Engine
// Copyright (C) GarageGames.com, Inc.
//-----------------------------------------------------------------------------

datablock StaticShapeData(TorqueLogoItem)
{
category = "Items";
shapeFile = "~/data/shapes/3dtorquelogo/torque_logo.dts";
function TorqueLogoItem::onCollision(%this, %obj, %col)
{
if(%col.getClassName()$="Player")
{
%client=%col.client;
%client.score++;
commandToClient(%client,'SetScoreCounter',%client.score);

%obj.delete();
%logoCount=logos.getCount();
if(%logoCount> 0)
return;
//otherwise Display victory screen
commandToClient(%client,'ShowVictory',%client.score);
{
}
#3
03/30/2008 (10:50 pm)
I'd still like you to look at your console.log--it's a critical step in debugging. It also would be very beneficial to you in the long run to learn how to use Torsion or Codeweaver to debug your scripts.

That being said, you have at least one typo--an extra { on the line one up from the bottom of the code. This will cause the entire file to not compile (which is stated on your console.log).

You also have a missing } after the line that says "shapeFile ="...looks as if you may have cut/paste something into the wrong location.

The function should probably (I'm reconstructing this based on what you typed, not looking at the tutorial itself, so make sure you check it!) look like this:

/-----------------------------------------------------------------------------
// Torque Game Engine
// Copyright (C) GarageGames.com, Inc.
//-----------------------------------------------------------------------------

datablock StaticShapeData(TorqueLogoItem)
{
category = "Items";
shapeFile = "~/data/shapes/3dtorquelogo/torque_logo.dts";
};

function TorqueLogoItem::onCollision(%this, %obj, %col)
{
  if(%col.getClassName()$="Player")
  {
    %client=%col.client;
    %client.score++;
    commandToClient(%client,'SetScoreCounter',%client.score);

    %obj.delete();
    %logoCount=logos.getCount();
    if(%logoCount> 0)
      return;
    //otherwise Display victory screen
    commandToClient(%client,'ShowVictory',%client.score);
  }
}
#4
03/31/2008 (12:14 am)
My console file is too big to post
#5
03/31/2008 (11:10 am)
This is what a TorqueScript parsing error looks like in the console.log file:
Compiling DRP/server/scripts/checkpoint.cs...
DRP/server/scripts/checkpoint.cs Line: 13 - parse error
>>> Advanced script error report.  Line 13.
>>> Some error context, with ## on sides of error halt:
   // The period is value is used to control how often the console

   // onTriggerTick callback is called while there are any objects

   // in the trigger.  The default value is 100 MS.

   tickPeriodMS = 100;

   OOPS = "no semi-colon after string"

};

##
##
//-----------------------------------------------------------------------------



function CheckPointTrigger::onEnterTrigger(%this,%trigger,%obj)

{
>>> Error report complete.

The last line of the datablock should have been:
OOPS = "no semi-colon after string";

The parser got the line number wrong: The actual error was at the end of line 12. Still, it is generally enough to see approximately where the error is, and once you have made more than a few errors and know what to look for ;) they are easier to spot.

With this kind of error, my TorqueScript IDE actually told me twice that there was an error.
In the "error" window:
error: ";" expected
file: DRP/server/scripts/checkpoint.cs...
Line/Column: 13/1

It also forced me to answer a popup dialog when I tried to run with an error: "There is an error. Do you want to continue?"

It even drew a little red squiggely underline under where the missing semi-colon should have been in the source view.

An IDE (Integrated Development Environment) can be an incredible boost to productivity.
#6
03/31/2008 (12:52 pm)
Thanks, you guys rule!