Null properties in datablock?
by FruitBatInShades · in Technical Issues · 02/24/2005 (5:56 am) · 4 replies
I am trying to add a property/variable to a datablock. The thing is, it is never set. Am I setting it in the wrong place?
but the console reports the varaible has no value:-
False= 0 , True = 1
isSmashed=
!isSmashed= 1
datablock StaticShapeData(Glass2)
{
category = "DamageItems";
shapeFile = "~/data/shapes/glass2.dts";
maxDamage = 1;
destroyedLevel = 1;
isSmashed = false;
};
//In a function somewhere
echo("False=" SPC false SPC ", True =" SPC true);
echo("isSmashed=" SPC %obj.isSmashed);
echo("!isSmashed=" SPC !%obj.isSmashed);
if (%obj.isSmashed)
{
//do something
}but the console reports the varaible has no value:-
False= 0 , True = 1
isSmashed=
!isSmashed= 1
#2
02/24/2005 (8:11 am)
Aren't true and false global statics?
#3
02/24/2005 (12:50 pm)
What does the following show in the console (in your function somewhere)??%obj.getdatablock().dump();
#4
Each item in the dataBlock is set in C++. Your isSmashed variable, I presume has not been added ( I would post an example but this is a public forum). The variable can be added script side by initializing it after an Object (one instance of the datablock) has been added.
THE SCRIPT ANSWER
Move the initalization to the Glass2::onAdd() to make it work
. . . .BUT BETTER,
C++
Do it you original way by adding the new variable to the staticshapedata class, that would be be Proper way of doing it!!!
02/24/2005 (1:04 pm)
A datablock is a bunch of variables that get loaded on the server then transmitted to the clients ONCE per game. Each item in the dataBlock is set in C++. Your isSmashed variable, I presume has not been added ( I would post an example but this is a public forum). The variable can be added script side by initializing it after an Object (one instance of the datablock) has been added.
THE SCRIPT ANSWER
Move the initalization to the Glass2::onAdd() to make it work
. . . .BUT BETTER,
C++
Do it you original way by adding the new variable to the staticshapedata class, that would be be Proper way of doing it!!!
Torque 3D Owner Matthew Langley
Torque
but aren't varialbes in script supposed to be referenced by % or $
so wouldn it be
$false
for a global variable ?
or Glass2::false ?