Difference between revisions of "Find - RefCollectionAlias"

From the Fallout4 CreationKit Wiki
Jump to navigation Jump to search
imported>Plplecuyer
 
imported>Qazaaq
(changed example)
 
Line 1: Line 1:
[[Category:Scripting]]
[[Category:Papyrus]]
[[Category:Non-Delayed Native Functions]]
'''Member of:''' [[RefCollectionAlias Script]]
'''Member of:''' [[RefCollectionAlias Script]]


Line 20: Line 17:
<source lang="papyrus">
<source lang="papyrus">
; Find the bob in the collection
; Find the bob in the collection
int index = CoolPeople.Find(Bob)
int index = People.Find(Bob)
if index < 0
If (index < 0)
  Debug.Trace("Bob isn't a cool person!")
    Debug.Trace("Bob could not be found.")
else
Else
  Debug.Trace("Bob is the " + location + "th cool person")
    Debug.Trace("Found Bob at index " + index + " in the people collection.")
endIf
EndIf
</source>
</source>


Line 31: Line 28:
*[[RefCollectionAlias Script]]
*[[RefCollectionAlias Script]]
*[[GetAt - RefCollectionAlias]]
*[[GetAt - RefCollectionAlias]]
[[Category:Scripting]]
[[Category:Papyrus]]
[[Category:Non-Delayed Native Functions]]

Latest revision as of 05:03, 6 April 2018

Member of: RefCollectionAlias Script

Searches for the specified form in the form list, returning its index (or a negative number if the form isn't found in the list)

Syntax[edit | edit source]

int Function Find(ObjectReference akFindRef) native

Parameters[edit | edit source]

  • akFindRef: Reference to search for

Return Value[edit | edit source]

The index of the reference in the reference collection. If the reference isn't found, this number will be negative.

Examples[edit | edit source]

; Find the bob in the collection
int index = People.Find(Bob)
If (index < 0)
    Debug.Trace("Bob could not be found.")
Else
    Debug.Trace("Found Bob at index " + index + " in the people collection.")
EndIf

See Also[edit | edit source]