Mod:Creation Kit/CountLinkedRefChain - ObjectReference

Member of: Mod:Creation Kit/ObjectReference Script

This function counts the number of linked refs that are in a linked Ref chain (example: A is linked to B is linked to C - this function will return 3)

Syntax
int Function CountLinkedRefChain(keyword apKeyword = None, int maxExpectedLinkedRefs = 100) native

Parameters

 * apKeyword: Keyword to check ref link against (see GetLinkedRef.)
 * Default: None
 * maxExpectedLinkedRefs: Maximum number of expected links. The function stops checking after it finds this many or finishes finding all of them.
 * Default: 100

Return Value
The total number of linked refs chained together or maxExpectedLinkedRefs, whichever is less. It will also stop and return the current count if it detects a loop.

Examples
int numLinkedRefs = countLinkedRefChain int numLinkedRefs = countLinkedRefChain(LightKeyword)
 * Count the number of refs in a linked ref chain to us
 * Count the number of refs in a linked ref chain, following the specified keyword for each one