%brick = BrickGroupxxxxxx;for(%i=0;%i<%brick.NTObjectCount_brickname;%i++){ %br = %brick.NTObject_brickname[%i]; do stuff to %br}
Er, no, the previously posted code will work. That's doing the same thing, just for only one player's bricks instead of all the bricks in the server.
%groupcount = mainbrickgroup.getcount();for(%i = 0; %i < %groupcount; %i++){ %group = mainbrickgroup.getobject(%i); %count = %group.getcount(); for(%j = 0; %j < %count; %j++) { %brick = %group.getobject(%j); if(%brick.getname() $= "_target") { blah(); } }}
It's hard to "think" straight when you've just got home from a 13 hour shift, I simply forgot.Blocki was right, good for him.
Er, no, the previously posted code will not do anything, it's looping through the main group containing the brickgroups and checking whether the groups have the name _targetCode: [Select]%groupcount = mainbrickgroup.getcount();for(%i = 0; %i < %groupcount; %i++){ %group = mainbrickgroup.getobject(%i); %count = %group.getcount(); for(%j = 0; %j < %count; %j++) { %brick = %group.getobject(%j); if(%brick.getname() $= "_target") { blah(); } }}
Can this script create lag if I have over 100,000 bricks?
Hmm, I see that can become problematic.
package brickNameStuff{ function fxDtsBrick::setNTObjectName(%this,%flag) { if(%flag $= "_myName") $myList = setField($myList,getFieldCount($myList),%this); return parent::setNTObjectName(%this,%flag); }};activatePackage(brickNameStuff);