Difference between revisions of "Complete Example Scripts"

Jump to navigation Jump to search
13 bytes removed ,  23:01, 5 October 2012
m
imported>JustinOther
imported>JustinOther
Line 129: Line 129:
<source lang="papyrus">ScriptName RamaFormListExampleScript extends ObjectReference
<source lang="papyrus">ScriptName RamaFormListExampleScript extends ObjectReference


Int iIndex
ObjectReference Reference
Actor Property PlayerREF Auto ; Least 'expensive' way to refer to the player
Actor Property PlayerREF Auto ; Least 'expensive' way to refer to the player
FormList Property ListOfObjectsFLST Auto ; see notes after script for more info on this property
FormList Property ListOfObjectsFLST Auto ; see notes after script for more info on this property
Line 136: Line 134:
Event OnTriggerEnter(ObjectReference akActionRef)
Event OnTriggerEnter(ObjectReference akActionRef)
If akActionRef == PlayerREF
If akActionRef == PlayerREF
iIndex = ListOfObjectsFLST.GetSize() ; Indices are offset by 1 relative to size
Int iIndex = ListOfObjectsFLST.GetSize() ; Indices are offset by 1 relative to size
While(iIndex > 0)
While iIndex > 0
iIndex -= 1
iIndex -= 1
Reference = ListOfObjectsFLST.GetAt(iIndex) as ObjectReference ; Note that you must typecast the entry from the formlist using 'As'.
ObjectReference kReference = ListOfObjectsFLST.GetAt(iIndex) As ObjectReference ; Note that you must typecast the entry from the formlist using 'As'.
If Reference.IsEnabled()
If kReference.IsEnabled()
Reference.Disable()
kReference.Disable()
Else ; If Reference.IsDisabled()  
Else ; If kReference.IsDisabled()  
Reference.Enable()
kReference.Enable()
EndIf
EndIf
EndWhile
EndWhile
Anonymous user

Navigation menu