CountLinkedRefChain - ObjectReference

From Creation Kit
Jump to: navigation, 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)


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


  • 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.


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

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

See Also