First scripting test
by Kevin Delval · in Torque Game Engine Advanced · 03/16/2009 (2:13 am) · 1 replies
I've run into a bit of a problem trying to test out a very simple script I wrote in torsion. I'm using the normal testProject you can create and have successfully loaded in the TestData.cs script I wrote. But I keep getting the error: scriptsAndAssets/server/scripts/TestData.cs (5): Unable to instantiate non-conobject class TestData.
I've already looked several things up on the wiki but I haven't been able to find the solution. This is the script I wipped up:
datablock TestData(MessageEchoer)
{
message = "TESTING";
size = 20;
};
function MessageEchoer::setMessage(%message)
{
TestData.message = %message;
}
function MessageEchoer::setSize(%size)
{
TestData.size = %size;
}
function MessageEchoer::testEcho(%this)
{
echo(message);
}
function MessageEchoer::setMode(%this)
{
camera.setMode(%this,CORPSE,0,0,0);
}
Does anyone have any suggestions?
I've already looked several things up on the wiki but I haven't been able to find the solution. This is the script I wipped up:
datablock TestData(MessageEchoer)
{
message = "TESTING";
size = 20;
};
function MessageEchoer::setMessage(%message)
{
TestData.message = %message;
}
function MessageEchoer::setSize(%size)
{
TestData.size = %size;
}
function MessageEchoer::testEcho(%this)
{
echo(message);
}
function MessageEchoer::setMode(%this)
{
camera.setMode(%this,CORPSE,0,0,0);
}
Does anyone have any suggestions?
About the author
Torque 3D Owner Markus Enkelmann
TestData does not exists. The syntax is:
datablock DatablockClass ( NewDatablockName : InheritDatablock )
{
className = “SomeName”;
DataBlockBody
};
DatablockClass – A predefined engine class which inherits from SimDataBlock or one of it’s children
(from torque documentation)
in the documentation (Scripting Reference/Quick Reference/Keywords, Datablocks/) you can find a listing of Current Datablock Classes and associated Object Classes.