Mouse question
by Buster · in Torque Game Builder · 08/09/2008 (1:05 pm) · 2 replies
Let say I have a function like this:
function testclass::onMouseDown(%this, %modifier, %worldPos, %mouseClicks)
{
}
and I have 100 testclass objects named: test0, test1,test2.....test99.
how would I go about putting 25 all of these names an a simset?
that why I can do some like this:
function testclass::onMouseDown(%this, %modifier, %worldPos, %mouseClicks)
{
for(%i=0 %i<=simset.count(); %i++)
{
if object is in simset
delete
else
do nothing
}
}
thanks for any help
function testclass::onMouseDown(%this, %modifier, %worldPos, %mouseClicks)
{
}
and I have 100 testclass objects named: test0, test1,test2.....test99.
how would I go about putting 25 all of these names an a simset?
that why I can do some like this:
function testclass::onMouseDown(%this, %modifier, %worldPos, %mouseClicks)
{
for(%i=0 %i<=simset.count(); %i++)
{
if object is in simset
delete
else
do nothing
}
}
thanks for any help
#2
As for adding test0, test1, ..., test24 to the SimSet:
08/09/2008 (10:21 pm)
I'm a bit confused - why would you want to iterate through the set to determine if it contains a specific object (and why do you need the set to delete the object, if you already know its name? Do you mean remove it from the set)?As for adding test0, test1, ..., test24 to the SimSet:
for(%i = 0; %i < %count; %i++)
{
%simset.add(%test[%i]); //%test[0] is shorthand for %test0
}
Associate James Ford
Sickhead Games
To put one object in the simset... %simset.add(%obj);
To put all of them...
for ( %i = 0; i < %count; %i++ ) { %obj = ( "test" @ %i ); if ( isObject( %obj ) ) %simset.add( %obj ); }