SimSet::isMember: is not an object(solved)
by Nir Ziso · in Torque Game Builder · 10/24/2006 (12:06 pm) · 16 replies
If an object is not amember in the simset the engine write that message to console
SimSet::isMember: is not an object
how to avoid this message on the console
SimSet::isMember: is not an object
how to avoid this message on the console
#2
every time an object do not belong to asimset the engine echo this message to console:
SimSet::isMember: is not an object
10/24/2006 (2:12 pm)
I know how to use simsetevery time an object do not belong to asimset the engine echo this message to console:
SimSet::isMember: is not an object
#3
10/24/2006 (2:14 pm)
Can you show the relevant code or make a simple example where the message pops up?
#4
10/24/2006 (2:17 pm)
Every time when an object is not amember of asimset try it
#5
10/24/2006 (2:31 pm)
I just tried it and it worked exactly how it's supposed to. It returned zero and did not write any warnings to the console. Please show the relevant code or make a simple example as Tom suggested so we can try to pinpoint your problem.
#6
Worked fine - tank is a named object in the levelbuilder. Echoed out "0" and no other messages in the console. Perhaps you are using an old build, I don't understand what you're trying to do, or you are using the function incorrectly or with objects that don't exist.
I think this would be a lot simpler if you just posted some code ;)
-NOOOOO! Beaten by Thomas again... You'd think we'd be able to coordinate better...
10/24/2006 (2:35 pm)
I tried:new SimSet(temp); temp.isMember(tank); echo(temp.isMember(tank));
Worked fine - tank is a named object in the levelbuilder. Echoed out "0" and no other messages in the console. Perhaps you are using an old build, I don't understand what you're trying to do, or you are using the function incorrectly or with objects that don't exist.
I think this would be a lot simpler if you just posted some code ;)
-NOOOOO! Beaten by Thomas again... You'd think we'd be able to coordinate better...
#7
10/24/2006 (2:43 pm)
This is how i write itfunction table::draw_mycards(%this,%carddeck)
{
%this.set = new SimSet();
for(%i=0;%i<13;%i++)
{
%myobject= new t2dStaticSprite()
{
scenegraph = %this;
class="cards";
config="mydatablock";
};
%this.set.add(%myobject);
}
$mycardsdeck=%this.set;//now this hold my simset
if($mycardsdeck.ismember(%myobject))
echo("member");
}
#8
That should fix it.
10/24/2006 (2:52 pm)
Well the first thing is that I'm pretty sure you make new SimSets usingnew SimSet(set);Not the way you did it.
That should fix it.
#9
%this.set = new SimSet();
look at C:\Program Files\TorqueGameBuilderPro\games\tools\levelEditor\scripts\saving.ed.cs(37):
10/24/2006 (2:57 pm)
Im shure i can write like that %this.set = new SimSet();
look at C:\Program Files\TorqueGameBuilderPro\games\tools\levelEditor\scripts\saving.ed.cs(37):
#10
10/24/2006 (3:00 pm)
When I tried it like that, I got an error when I called isMember. Did you try it my way?
#11
10/24/2006 (3:05 pm)
Yes i tried it and its work but why my syntax do not work?
#12
10/24/2006 (3:10 pm)
No idea. I'd just use what works ;)
#13
if ( $brushSet.isMember( %brush ) )
$brushSet.remove( %brush );
look at this code its work to so its not the problem C:\Program Files\TorqueGameBuilderPro\games\tools\levelEditor\scripts\projectManagement.ed.cs(284)
10/24/2006 (3:14 pm)
$brushSet = new SimSet();if ( $brushSet.isMember( %brush ) )
$brushSet.remove( %brush );
look at this code its work to so its not the problem C:\Program Files\TorqueGameBuilderPro\games\tools\levelEditor\scripts\projectManagement.ed.cs(284)
#14
my problem is that sometimes %pickObj is not an object so when i ask:
$mycardsdeck.ismember(%pickObj)
i get the message SimSet::isMember: is not an object
so i just add this to my code:
and all works
thanks alot for your help tom && stephen
10/25/2006 (4:44 am)
I found out!!!my problem is that sometimes %pickObj is not an object so when i ask:
$mycardsdeck.ismember(%pickObj)
i get the message SimSet::isMember: is not an object
so i just add this to my code:
if(isObject(%pickObj))
and all works
thanks alot for your help tom && stephen
#15
10/25/2006 (9:56 am)
Cool!
#16
11/08/2011 (4:00 pm)
Bumping a very old thread because I had a similar issue. I'm using multiple Simsets and have code to check which one an object belongs to. I didn't want it outputting to the console.log everytime I performed the check. You can edit the TGB source code to remove this. In the Console/SimSet.cc file, around line 455, comment out the Con::printf line as below -ConsoleMethod(SimSet, isMember, bool, 3, 3, "(object) @return Returns true if specified object is a member of the set, and false otherwise")
{
argc;
SimObject *testObject = Sim::findObject(argv[2]);
if(!testObject)
{
//Con::printf("SimSet::isMember: %s is not an object.", argv[2]);
return false;
}
object->lock();
for(SimSet::iterator i = object->begin(); i != object->end(); i++)
{
if(*i == testObject)
{
object->unlock();
return true;
}
}
object->unlock();
return false;
}
Torque 3D Owner Stephen Zepp
which is not correct usage.