How do I use OwnedResource() Function?

Returns the n th resource currently being used by the entity. Each resource is referenced according to the order it was put into use so that the longest held resource is OwnedResource(1). The most recently captured resource can be referenced by omitting the number: OwnedResource().

Example

The OwnedResource() function is useful when a decision must be made based on the resource that was captured. For example, suppose an entity captures either Worker_1 or Worker_2 in order to perform an activity. If Worker_1 is used, the activity takes 5 minutes. If Worker_2 is used, the activity takes 6.5 minutes. This can be defined using the following Action logic.

GET Worker_1 OR Worker_2
IF OWNEDRESOURCE() = Worker_1 THEN {TIME(5.0 min)}
ELSE {TIME(6.5 min)}
FREE OWNEDRESOURCE()

  • This function cannot be assigned a resource name in Action logic. For example, an assignment statement like OwnedResource() = Worker_1 will generate an error.

Functions

Was this article helpful?

Related Articles

Go to Top