Datablock From String
by Matt "Mr. Pig" Razza · in Torque Game Engine · 05/07/2007 (2:45 pm) · 2 replies
Is it possible to find the datablock in the engine from the datablocks name (in char format).
For example:
Where playerClassData is a datablock class and argv[2] contains the string for the name of the given datablock (this is a typecast example).
Thanks.
For example:
ConsoleMethod(Player, setClass, void, 3, 3, "<player>.setClass(CLASS DATABLOCK);")
{
object->setClass((playerClassData)argv[2]);
}Where playerClassData is a datablock class and argv[2] contains the string for the name of the given datablock (this is a typecast example).
Thanks.
About the author
#2
That's the command you want in C++. Just pass the string containing the name into the method.
05/09/2007 (5:18 pm)
Sim::findObject("datablock name");That's the command you want in C++. Just pass the string containing the name into the method.
Torque Owner Matt "Mr. Pig" Razza