Complete Example Scripts: Difference between revisions

Jump to navigation Jump to search
→‎A Fully Functional Dwemer Button: Made capitalisation more consistent, and changed event parameter names to be in line with documentation. Also removed unneeded code handling "Self"
imported>Cipscis
(→‎A Trigger To Activate When Player Walks Through It: Updated capitalisation and parameter names to make the more in line with documentation)
imported>Cipscis
(→‎A Fully Functional Dwemer Button: Made capitalisation more consistent, and changed event parameter names to be in line with documentation. Also removed unneeded code handling "Self")
Line 58: Line 58:
Scriptname DwemerButtonExampleScript extends ObjectReference   
Scriptname DwemerButtonExampleScript extends ObjectReference   


objectReference property objSelf auto hidden
ObjectReference property objSelf auto hidden
sound property QSTAstrolabeButtonPressX auto
Sound property QSTAstrolabeButtonPressX auto


;==================
;==================
Line 66: Line 66:
;this scripted object
;this scripted object


event onCellAttach()
Event OnCellAttach()
objSelf = self as objectReference
PlayAnimation("Open")
playAnimation("Open")
EndEvent
endEvent


;==================
;==================


EVENT onActivate (objectReference triggerRef)
Event OnActivate(ObjectReference akActionRef)


  if(triggerRef == game.getplayer())
if (akActionRef == Game.GetPlayer())
    ;--- sound and animation
 
    playAnimationAndWait("Trigger01","done")
    if QSTAstrolabeButtonPressX
    QSTAstrolabeButtonPressX.play(objSelf)
    endif


    ;actual code for what button should do
;--- sound and animation
    Debug.MessageBox("Joy!")
 
PlayAnimationAndWait("Trigger01", "done")
if (QSTAstrolabeButtonPressX)
QSTAstrolabeButtonPressX.Play(Self)
endif
 
;actual code for what button should do
Debug.MessageBox("Joy!")
  endif
endif


endEVENT
EndEvent


</source>
</source>
Anonymous user

Navigation menu