Dynamically adding objects / datablocks
by Orion Elenzil · in Torque Game Engine · 08/23/2004 (12:34 pm) · 2 replies
Hi All.
This thread may belong in a more advanced forum,
but i'll try it out here.
So i'd like to be able to drag-and-drop a resource,
say a .dts file, onto the torque window
and have the object be instanciated in the game.
I've got the drag-n-drop going thru to a script function, eg:
function addFile(%theFile)
{ ... }
How would i have addFile() create a new ItemData datablock ?
Would i need to do something like construct a string
which contains the syntax for a new datablock and eval() the string ?
Also,
am i correct in understanding that i can't do something like this:
//-----------------------------------------------
%shapeFile1 = "some dts file";
%shapeFile2 = "some other dts file";
datablock ItemData(justAStaticShape)
{ };
%newShape1 = new Item()
{
datablock = justAStaticShape;
};
%newShape1.datablock.shapeFile = %shapeFile1;
%newShape2 = new Item()
{
datablock = justAStaticShape;
};
%newShape2.datablock.shapeFile = %shapeFile2;
//-----------------------------------------------
- that is,
i can't use the same datablock for two different .dts files.
many thanks in advance,
Orion
This thread may belong in a more advanced forum,
but i'll try it out here.
So i'd like to be able to drag-and-drop a resource,
say a .dts file, onto the torque window
and have the object be instanciated in the game.
I've got the drag-n-drop going thru to a script function, eg:
function addFile(%theFile)
{ ... }
How would i have addFile() create a new ItemData datablock ?
Would i need to do something like construct a string
which contains the syntax for a new datablock and eval() the string ?
Also,
am i correct in understanding that i can't do something like this:
//-----------------------------------------------
%shapeFile1 = "some dts file";
%shapeFile2 = "some other dts file";
datablock ItemData(justAStaticShape)
{ };
%newShape1 = new Item()
{
datablock = justAStaticShape;
};
%newShape1.datablock.shapeFile = %shapeFile1;
%newShape2 = new Item()
{
datablock = justAStaticShape;
};
%newShape2.datablock.shapeFile = %shapeFile2;
//-----------------------------------------------
- that is,
i can't use the same datablock for two different .dts files.
many thanks in advance,
Orion
About the author
#2
Thanks erik.
the objectbuilder source code looks useful.
this will show exactly how new i am,
but how do i get to the object builder
in the runtime app ?
- is it the tree controls in the right hand side
of the World Editor Inspector etc ?
08/23/2004 (1:53 pm)
[edited]Thanks erik.
the objectbuilder source code looks useful.
this will show exactly how new i am,
but how do i get to the object builder
in the runtime app ?
- is it the tree controls in the right hand side
of the World Editor Inspector etc ?
Torque Owner Erik Madison