GetComponent

Category: Objects / Components
Since engine version: 1.0 OC

Description

Used to determine object components.

Syntax

int / id GetComponent(id component, int index);

Parameters

component:
[opt] Object component of which to determine the count. If not specified, index is used and the id of the component is returned.
index:
[opt] Index of the component to be returned. This parameter is ignored if component is specified. Returns the id of the indicated component which can then be used to determine the count in a subsequent call to GetComponent.

Remark

Also see Properties.

Example

var i,cid,num;
while (id = GetID()->GetComponent(nil, i++))
	if ((num = GetComponent(id) - GetID()->GetComponent(id)) > 0)
		while (num--) CreateObject(id);
Creates all components which are still missing in the calling object (e.g. in a construction site) in front of the object.
See also: SetComponent, Split2Components
Cucaracha, 2002-05