Torque Script Question
by Vittorio Cellucci · in Torque Game Engine · 02/25/2007 (12:42 pm) · 3 replies
Hi,
can someone help me straighten out dataobjects, namespaces and objects? I come from a C++ background, with some Java and C#.
Why does this code not work?
enableWinConsole(true);
function CSuperMan::hi(%this)
{
echo("CS HI");
}
%so = new sss(CSuperMan)
{
count = 1;
};
so.hi();
echo("hi");
I'm expecting to see the output
CS HI
hi
But I get errors instead:
main.cs (0): Unable to instantiate non-conobject class sss.
main.cs (0): Unable to find object: 'so' attempting to call function 'hi'
hi
%
Any help would be super,
Thanks.
can someone help me straighten out dataobjects, namespaces and objects? I come from a C++ background, with some Java and C#.
Why does this code not work?
enableWinConsole(true);
function CSuperMan::hi(%this)
{
echo("CS HI");
}
%so = new sss(CSuperMan)
{
count = 1;
};
so.hi();
echo("hi");
I'm expecting to see the output
CS HI
hi
But I get errors instead:
main.cs (0): Unable to instantiate non-conobject class sss.
main.cs (0): Unable to find object: 'so' attempting to call function 'hi'
hi
%
Any help would be super,
Thanks.
Associate William Lee Sims
Machine Code Games
1) You have no "sss" class defined. Use ScriptObject, as in:
%so = new ScriptObject(CSuperMan) { count = 1; };
2) You need to continue usnig "%" on the "so" variable, as in:
%so.hi();
I think that will cover your problems... if not, just re-post your results and I'll take a look.