Welcome to the Creatures Wiki! Log in and join the community.

HIST FINR

From Creatures Wiki
Jump to navigation Jump to search

HIST FINR is a CAOS command that searches the life events for a creature with a given moniker for a given life event type, but in reverse.

Usage[edit]

Syntax: HIST FINR moniker(str) event_type(integer) from_index(integer)

Searches from the end to the front of the moniker's event list for event_type. It will begin at the life event before from_index; use -1 to find the last occurrence of the event.

Returns the event number if it exists and -1 if it does not.

Example[edit]

The Creature History uses it to find the death event of creatures who are no longer alive - 'death' is life event 7:

*where ov01 is the moniker of the selected creature
* death event age if there is one
setv va03 hist finr ov01 7 -1
doif va03 = -1
	* last event otherwise
	setv va03 hist coun ov01
	subv va03 1
endi
setv va01 hist tage ov01 va03
setv va10 hist cage ov01 va03

See also[edit]

  • HIST FIND - searches life events, but in order