Difference between revisions of "GetMiscComponents - MiscObject"
GetMiscComponents - MiscObject (edit)
Revision as of 20:29, 2 December 2018
, 20:29, 2 December 2018code example
imported>Qazaaq (Added wiki links and some minor details.) |
imported>Qazaaq (code example) |
||
(3 intermediate revisions by the same user not shown) | |||
Line 2: | Line 2: | ||
{{Template:Papyrus:RequiredF4SE|version=0.4.2}} | {{Template:Papyrus:RequiredF4SE|version=0.4.2}} | ||
Gets an array of [[MiscComponent Struct - MiscObject|MiscComponent]] | Gets the ''[[Template:Editor:Property:Component Data|Component Data]]'' for this [[MiscItem]] as an array of [[MiscComponent Struct - MiscObject|MiscComponent]] structures. | ||
== Syntax == | == Syntax == | ||
Line 17: | Line 17: | ||
== Examples == | == Examples == | ||
<source lang="papyrus"> | <source lang="papyrus"> | ||
; Count | ; Count how many different types of components are used | ||
int count = | MiscObject DeskFanOffice01 | ||
Debug.Trace( | |||
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 | |||
</source> | </source> | ||
<source lang="papyrus"> | <source lang="papyrus"> | ||
{For each miscellaneous component} | Scriptname Example extends ScriptObject | ||
import MiscObject | |||
If (components) | |||
MiscObject Property DeskFanOffice01 Auto Const Mandatory | |||
Event OnInit() | |||
{For each miscellaneous component} | |||
MiscComponent[] components = DeskFanOffice01.GetMiscComponents() | |||
Else | If (components) | ||
int index = 0 | |||
EndIf | 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 | |||
</source> | </source> | ||