GetIndex Method

See Also Applies To Example Model

Returns the collection index of the specified object.

object expression.GetIndex (Member)

object expression    Required. An object expression that evaluates to an object in the Applies To list.

Member    Required Bot if applied to the Bots or Group objects, Cell if applied to the Cells or Region objects.

Remarks

GetIndex returns 0 if the member does not exist in the collection.

Example

In the following example, the speed of a Bot is set to the average speed of the previous and next Bot objects in the Bots collection.

Index = Bots.GetIndex(ThisBot)
ThisBot.Speed = (Bots(Index-1).Speed + Bots(Index+1).Speed)/2