Author Topic: Find all bricks (oh ya its solved)  (Read 672 times)

Why doesn't this work?
  for(%i=0;%i<ClientGroup.GetCount();%i++)
   {
   %bg = ClientGroup.GetObject(%i);
      for(%a=0;%a<%bg.getCount();%a++)
      {
      %bg.getObject(%a).brickUnLocked = 0;
      }
   }
« Last Edit: February 10, 2012, 04:26:16 PM by swollow »

Because you're going through the client group, and then going through objects attached to the client, which will be nothing.

Code: [Select]
for(%a = 0; %a < mainBrickGroup.getCount(); %a++)
{
%bg = mainBrickGroup.getObject(%a);

for(%b = 0; %b < %bg.getCount(); %b++)
{
%brick = %bg.getObject(%b);

// Do Stuff
}
}

that is soooo pertaining to my add-on >.>

Because you're going through the client group, and then going through objects attached to the client, which will be nothing.

Code: [Select]
for(%a = 0; %a < mainBrickGroup.getCount(); %a++)
{
%bg = mainBrickGroup.getObject(%a);

for(%b = 0; %b < %bg.getCount(); %b++)
{
%brick = %bg.getObject(%b);

// Do Stuff
}
}
thanks new kalphiter Iban
that is soooo pertaining to my add-on >.>
I'm making a mod that the bricks become locked when they are loaded

I'm making a mod that the bricks become locked when they are loaded

Something like
Code: [Select]
package bleh {
    function FxDTSBrick::onLoadPlant(%this) {
        if (%lock) {
            %this.locked = true;
        }
        parent::onLoadPlant(%this);
    }
}; activatePackage(bleh);
?

Something like
Code: [Select]
package bleh {
    function FxDTSBrick::onLoadPlant(%this) {
        if (%lock) {
            %this.locked = true;
        }
        parent::onLoadPlant(%this);
    }
}; activatePackage(bleh);
?
It'd have to be done a different way. ie keeping a record of all bricks that are locked somehow for each save.

It'd have to be done a different way. ie keeping a record of all bricks that are locked somehow for each save.
The %lock was only a placeholder.