CountLinkedRefChain - ObjectReference

From the CreationKit Wiki
Revision as of 11:11, 21 October 2011 by imported>Jlundin
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Member of: 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)

Parameters

  • apKeyword: Keyword to check ref link against (see GetLinkedRef.)
  • maxExpectedLinkedRefs: Maximum number of expected links. The function stops checking after it finds this many or finishes finding all of them. This is used as a safety precaution to premature bail out of a while loop in cases where something in the linked ref chain links back to something in the chain previously, which would result in an infinite loop.

Return Value

The total number of linked refs chained together or maxExpectedLinkedRefs, whichever is less.

Examples

; Count the number of refs in a linked ref chain to us
int numLinkedRefs = countLinkedRefChain()

See Also