Background for Skyrim SE
Member of the ObjectReference script
intfunctioncountLinkedRefChain(KeywordapKeyword=NONE, intmaxExpectedLinkedRefs=100)

Description

Wiki Description

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)

Documentation Comment

jtucker, jduvall
This function counts the number of linked refs that are in a linked Ref chain (ie object is linked to A, A is linked to B, etc. this then counts all the linked refs.)
Often used in conjunction with GetNthLinkedRef()
*** WARNING: Having a link ref chain that at any point loops back on itself and calling this function will result in very bad things. Don't do that!***


Parameters

  1. KeywordapKeyword=NONE

    CK Wiki Description

    Keyword to check ref link against (see ObjectReference.GetLinkedRef(...).)

  2. intmaxExpectedLinkedRefs=100

    CK Wiki Description

    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.


Examples

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

Auto-Generated Example

Keyword myKeyword__apKeyword
int myInt__maxExpectedLinkedRefs

int returnedValue = myObjectReference__toCallFunctionOn.countLinkedRefChain(myKeyword__apKeyword, myInt__maxExpectedLinkedRefs)

Related Pages


Additional References

View this function’s page on the Skyrim Creation Kit Wiki

Some data provided by the Skyrim Creation Kit Wiki. Licensed under the Creative Commons Attribution-ShareAlike license.