Game Development Community

Help

by Sarah Ewens · in Torque 2D Beginner · 08/23/2013 (3:27 pm) · 4 replies

I know this is such a simple thing but i'm working through the tutorials https://www.garagegames.com/account/activate?code=bf7e7834d35ce40266d89f6e3b057577 and cannot using the code provided get my toy to show up ... help!
I know it's likely to be something glaringly obvious... but i can't see it
my code is as follows
main.cs
function Zanphortoy::create(%this)
{
echo("@@@ create");
}

function Zanphortoy::destroy(%this)
{
echo("@@@destroy");
}


and

module.taml

<ModuleDefinition
ModuleID"Zaphnortoy"
VersionID="1"
Description="Zaphnor Chronicle"
Dependencies="ToyAssets=1"
Type="toy"
ToyCategoryIndex="5"
ScriptFile="main.cs"
CreateFunction="create"
DestroyFunction="destroy">
<DeclaredAssets
Path="assets"
Extension="asset.taml"
Recurse="true"/>
</ModuleDefinition>

in folder modules/Zaphnortoy/1

About the author

Recent Threads


#1
08/23/2013 (6:26 pm)
For future reference, you can use code tags (Markup Lite reference) for your code:

function Zanphortoy::create(%this)
{
   echo("@@@ create");
}

function Zanphortoy::destroy(%this)
{
   echo("@@@destroy");
}

Ok, the class name used above does not match the ModuleID given in the TAML file. Next, you were missing the = sign in that ModuleID = "Zaphnortoy" line.

<ModuleDefinition
   ModuleID="Zaphnortoy"
   VersionID="1"
   Description="Zaphnor Chronicle"
   Dependencies="ToyAssets=1"
   Type="toy"
   ToyCategoryIndex="5"
   ScriptFile="main.cs"
   CreateFunction="create"
   DestroyFunction="destroy">
   <DeclaredAssets
      Path="assets"
      Extension="asset.taml"
      Recurse="true"/>
</ModuleDefinition>

So, is it Zanphortoy or Zaphnortoy? Pick one, because they have to match....

Finally, always look in your console.log file - it is located in the game folder. It will contain clues to help you debug issues like this.
#2
08/24/2013 (4:29 pm)
Thanks guys for all the help... felling a little stupid but sometimes you can't see the wood for the trees and thanks for the heads up on the console.log file
#3
08/24/2013 (9:38 pm)
Common beginner mistakes. No problem. Just wait until the first time you forget a semi-colon in a 5000 line script file....
#4
08/25/2013 (8:09 am)
Good stuff Richard.

@Sarah - Here's some additional information. If you open the main.cs in the root directory, you will find two lines of code that set the echo info for the ModuleDatabase and AssetManager to false. When you are not getting any errors, sometimes you must set one or both to true. Your console.log will explode with much more information, but this is usually necessary to really find an issue related to the two systems.