GetBlobsByNameListSize

From King Arthur's Gold Wiki
Revision as of 21:10, 20 August 2012 by Shadlington (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

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;
  }
}