Difference between revisions of "GetBlobsByNameListSize"

From King Arthur's Gold Wiki
Jump to: navigation, search
(Created page with "<onlyinclude> Returns the number of CBlobs in the 'Blobs By Name List'. </onlyinclude> Make sure you call populateBlobsByNameList before using this function, to ensure t...")
 
(No difference)

Latest revision as of 20:10, 20 August 2012

Returns the number of CBlobs in the 'Blobs By Name List'.


Make sure you call populateBlobsByNameList before using this function, to ensure the list is up-to-date with the CBlobs of the correct type. You'll most likely want to use this to provide the number of items in the list so that you can iterate over them with getBlobsByNameListBlob. It may also be useful if you want to do something based on how many CBlobs there are of a particular type.

int getBlobsByNameListSize()

Example from Rules/Scripts/WAR_Players.as:

// gather all tents and select assigned team's tent
CBlob@ tent;
populateBlobsByNameList( "tent" );
 
for (int i=0; i < getBlobsByNameListSize(); i++){
  CBlob@ blob = getBlobsByNameListBlob(i);
  if (blob.getTeamNum() == assignedTeamNum)
  {	
    @tent = blob; 		
    break;
  }
}