GetMiscComponents - MiscObject

Revision as of 20:29, 2 December 2018 by imported>Qazaaq (code example)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

F4SE Member of: MiscObject Script
Requires F4SE version 0.4.2 or higher.

Gets the Component Data for this MiscItem as an array of MiscComponent structures.

SyntaxEdit

MiscComponent[] Function GetMiscComponents() Native

ParametersEdit

  • None

Return ValueEdit

An array of MiscComponent structures.

ExamplesEdit

; Count how many different types of components are used
MiscObject DeskFanOffice01

int count = DeskFanOffice01.GetMiscComponents().Length
If (count == 1)
    Debug.Trace(DeskFanOffice01 + " has one type of component.")
ElseIf (count > 1)
    Debug.Trace(DeskFanOffice01 + " has "+count+" types of component.")
Else
    Debug.Trace(DeskFanOffice01 + " has no components.")
EndIf


Scriptname Example extends ScriptObject
import MiscObject

MiscObject Property DeskFanOffice01 Auto Const Mandatory

Event OnInit()
    {For each miscellaneous component}
    MiscComponent[] components = DeskFanOffice01.GetMiscComponents()
    If (components)
        int index = 0
        While (index < components.Length)
            Debug.Trace("("+index+" of "+components.Length+") There is "+components[index].Count+" of the '"+components[index].Object+"' component")
            index += 1
        EndWhile
    Else
        Debug.Trace(DeskFanOffice01+" has no components.")
    EndIf
EndEvent

NotesEdit

See AlsoEdit