Author Topic: How to hide %object.Plant() console errors?  (Read 1197 times)

So I'm trying to get whether a brick is floating with %object.Plant();, and that part works, but it spams the console with "fxDTSBrick::InsertIntoTree - Brick has already been inserted"... Is there a way to not call the function and return what I need or is this unavoidable?

Show us your code.

Show us your code.
That is the code. %object is a brick grabbed from for(%i=0;%i<%client.brickgroup.getcount();%i++)
%object = %client.brickgroup.getobject(%i); - those are the main segments of the code that get the %object.

I can't really help you if you refuse to show me the code.

I can't really help you if you refuse to show me the code.
Alright, have fun lol
Code: [Select]
function FMFloatClear(%client)
{
if($FMKillEnabled != 1){return;}
if(%reps<1){%reps = 1;}
if(%client<0){return;}
for(%i=0;%i<%client.brickgroup.getcount();%i++)
{
%object = %client.brickgroup.getobject(%i);
if(isObject(%object))
{
while(%object.Physing == 1 && isObject(%object = %client.brickgroup.getobject(%i)))
{
if(%i >= %client.brickgroup.getcount()){break;}
if(isObject(%object = %client.brickgroup.getobject(%i)))
{
%object = %client.brickgroup.getobject(%i);
}
%i++;
}
if(isObject(%object) && %object.Physing != 1)
{
if(!isObject(%object.getDownBrick(0)) && !isObject(%object.getupBrick(0))){calculateFMPhysics(%object);}
if(%object.Plant() == 2){calculateFMPhysics(%object);}
if(%object.getDownBrick(0).Physing == 1){calculateFMPhysics(%object);}
while(isObject(%object.getDownBrick(0)))
{
if(%object.Plant() == 1){calculateFMPhysics(%object);}
%object = %object.getDownBrick(0);
}
}
}
}
return;
}

"Have fun" it's like you want us to do it all for you

Also, that code looks like you've over complicated it. I don't understand why there's a return at the end.

The main reason why it's giving you that console spam is because you might be trying to force plant in the same spot. Although, I don't really know if this is the problem, (Thanks Zeblote) add debugs or something so you know where it's causing the console spam. Although if you do get stuck you should add debugs on places

Edit:
if(%client<0){return;} should either be if(!isObject(%client)) return; or if(!isObject(%client)){return;}, you're going to have silly errors with clients if it gets checked, but just use isObject for checking if objects exist
« Last Edit: March 21, 2016, 10:12:32 AM by Kyuande »

You're trying to plant bricks that are already planted. Use getDistanceFromGround instead.

"Have fun" it's like you want us to do it all for you
That's not how I meant it lol. I managed to fix it on my own after a while of messing around. Thanks though

Show us your code. You may still have flaws in the code.

That's not how I meant it lol. I managed to fix it on my own after a while of messing around. Thanks though
Please show a solution in case someone wants to do something like this in the future.