Form Script: Difference between revisions

Jump to navigation Jump to search
405 bytes added ,  24 October 2013
m
Formatting Change
imported>Thingy Person
(→‎Member Functions: PlayerKnows is a bool function)
imported>CraftySentinel
m (Formatting Change)
Line 19: Line 19:


== Member Functions ==
== Member Functions ==
'''int Function [[GetFormID - Form|GetFormID]]()'''
*Returns this form's form ID.


'''int Function [[GetGoldValue - Form|GetGoldValue]]()'''
{|class="wikitable" width =100%
*Returns this form's value in gold.
!style="text-align:left;"|Function
!style="text-align:left;"|Description
|-
|[[GetFormID - Form|Int '''GetFormID'''()]]
|Returns this form's form ID.
|-


'''bool Function [[HasKeyword - Form|HasKeyword]](Keyword akKeyword)'''
|[[GetGoldValue - Form|Int '''GetGoldValue'''()]]
*Returns if this form has the specified [[Keyword Script|Keyword]] attached.
|Returns this form's value in gold.
|-


'''bool Function [[PlayerKnows - Form|PlayerKnows]]()'''
|[[HasKeyword - Form|Bool '''HasKeyword'''(Keyword ''akKeyword'')]]
*Is the "Known" flag set on the form?
|Returns if this form has the specified [[Keyword Script|Keyword]] attached.
|-


'''Function [[RegisterForAnimationEvent - Form|RegisterForAnimationEvent]](ObjectReference akSender, string asEventName)'''
|[[PlayerKnows - Form|Bool '''PlayerKnows'''()]]
*Registers this form to receive the specified animation event from the specified object.
|Is the "Known" flag set on the form?
|-


'''Function [[RegisterForLOS - Form|RegisterForLOS]](Actor akViewer, ObjectReference akTarget)'''
|[[RegisterForAnimationEvent - Form|'''RegisterForAnimationEvent'''(ObjectReference ''akSender'', String ''asEventName'')]]
*Registers this form to receive gain and lost LOS events between the viewer and the target.
|Registers this form to receive the specified animation event from the specified object.
|-


'''Function [[RegisterForSingleLOSGain - Form|RegisterForSingleLOSGain]](Actor akViewer, ObjectReference akTarget)'''
|[[RegisterForLOS - Form|'''RegisterForLOS'''(Actor ''akViewer'', ObjectReference ''akTarget'')]]
*Registers this form to receive a single LOS gain event when the viewer sees the target.
|Registers this form to receive gain and lost LOS events between the viewer and the target.
|-


'''Function [[RegisterForSingleLOSLost - Form|RegisterForSingleLOSLost]](Actor akViewer, ObjectReference akTarget)'''
|[[RegisterForSingleLOSGain - Form|'''RegisterForSingleLOSGain'''(Actor ''akViewer'', ObjectReference ''akTarget'')]]
*Registers this form to receive a single LOS lost event when the viewer loses sight of the target.
|Registers this form to receive a single LOS gain event when the viewer sees the target.
|-


'''Function [[RegisterForSingleUpdate - Form|RegisterForSingleUpdate]](float afInterval)'''
|[[RegisterForSingleLOSLost - Form|'''RegisterForSingleLOSLost'''(Actor ''akViewer'', ObjectReference ''akTarget'')]]
*Registers this form to receive a single update event in the specified time.
|Registers this form to receive a single LOS lost event when the viewer loses sight of the target.
|-


'''Function [[RegisterForSingleUpdateGameTime - Form|RegisterForSingleUpdateGameTime]](float afInterval)'''
|[[RegisterForSingleUpdate - Form|'''RegisterForSingleUpdate'''(Float ''afInterval'')]]
*Registers this form to receive a single update event in the specified number of game hours.
|Registers this form to receive a single update event in the specified time.
|-


'''Function [[RegisterForSleep - Form|RegisterForSleep]]()'''
|[[RegisterForSingleUpdateGameTime - Form|'''RegisterForSingleUpdateGameTime'''(Float ''afInterval'')]]
*Registers this form to receive sleep events for when the player goes to sleep or wakes up.
|Registers this form to receive a single update event in the specified number of game hours.
|-


'''Function [[RegisterForTrackedStatsEvent - Form|RegisterForTrackedStatsEvent]]()'''
|[[RegisterForSleep - Form|'''RegisterForSleep'''()]]
*Registers this form to receive tracked stats events for when tracked stats are updated.
|Registers this form to receive sleep events for when the player goes to sleep or wakes up.
|-


'''Function [[RegisterForUpdate - Form|RegisterForUpdate]](float afInterval)'''
|[[RegisterForTrackedStatsEvent - Form|'''RegisterForTrackedStatsEvent'''()]]
*Registers this form to receive update events with the specified interval, or changes the update interval.
|Registers this form to receive tracked stats events for when tracked stats are updated.
|-


'''Function [[RegisterForUpdateGameTime - Form|RegisterForUpdateGameTime]](float afInterval)'''
|[[RegisterForUpdate - Form|'''RegisterForUpdate'''(Float ''afInterval'')]]
*Registers this form to receive update events with the specified interval in game time hours, or changes the update interval.
|Registers this form to receive update events with the specified interval, or changes the update interval.
|-


'''Function [[StartObjectProfiling - Form|StartObjectProfiling]]()'''
|[[RegisterForUpdateGameTime - Form|'''RegisterForUpdateGameTime'''(Float ''afInterval'')]]
*Starts profiling all scripts attached to this form.
|Registers this form to receive update events with the specified interval in game time hours, or changes the update interval.
|-


'''Function [[StopObjectProfiling - Form|StopObjectProfiling]]()'''
|[[StartObjectProfiling - Form|'''StartObjectProfiling'''()]]
*Stops profiling all scripts attached to this form.
|Starts profiling all scripts attached to this form.
|-


'''Function [[UnregisterForAnimationEvent - Form|UnregisterForAnimationEvent]](ObjectReference akSender, string asEventName)'''
|[[StopObjectProfiling - Form|'''StopObjectProfiling'''()]]
*Unregisters this from from receiving the specified animation event from the specified object.
|Stops profiling all scripts attached to this form.
|-


'''Function [[UnregisterForLOS - Form|UnregisterForLOS]](Actor akViewer, ObjectReference akTarget)'''
|[[UnregisterForAnimationEvent - Form|'''UnregisterForAnimationEvent'''(ObjectReference ''akSender'', String ''asEventName'')]]
*Unregisters this form from any LOS events between the viewer and target.
|Unregisters this from from receiving the specified animation event from the specified object.
|-


'''Function [[UnregisterForSleep - Form|UnregisterForSleep]]()'''
|[[UnregisterForLOS - Form|'''UnregisterForLOS'''(Actor ''akViewer'', ObjectReference ''akTarget'')]]
*Unregisters this form from sleep events.
|Unregisters this form from any LOS events between the viewer and target.
|-


'''Function [[UnregisterForTrackedStatsEvent - Form|UnregisterForTrackedStatsEvent]]()'''
|[[UnregisterForSleep - Form|'''UnregisterForSleep'''()]]
*Unregisters this form from tracked stats events.
|Unregisters this form from sleep events.
|-


'''Function [[UnregisterForUpdate - Form|UnregisterForUpdate]]()'''
|[[UnregisterForTrackedStatsEvent - Form|'''UnregisterForTrackedStatsEvent'''()]]
*Unregisters this form from update events.
|Unregisters this form from tracked stats events.
|-


'''Function [[UnregisterForUpdateGameTime - Form|UnregisterForUpdateGameTime]]()'''
|[[UnregisterForUpdate - Form|'''UnregisterForUpdate'''()]]
*Unregisters this form from game time update events.
|Unregisters this form from update events.
|-
 
|[[UnregisterForUpdateGameTime - Form|'''UnregisterForUpdateGameTime'''()]]
|Unregisters this form from game time update events.
|-
 
|}


== SKSE Member Functions ==
== SKSE Member Functions ==
'''int Function [[GetType - Form|GetType]]()'''
*Returns this form's form typecode.


'''string Function [[GetName - Form|GetName]]()'''
{|class="wikitable" width =100%
*Returns this form's full name.
!style="text-align:left;"|Function
!style="text-align:left;"|Description
|-
|[[GetType - Form|Int '''GetType'''()]]
|Returns this form's form typecode.
|-
 
|[[GetName - Form|String '''GetName'''()]]
|Returns this form's full name.
|-


'''Function [[SetName - Form|SetName]](string name)'''
|[[SetName - Form|'''SetName'''(String ''name'')]]
*Sets this form's full name.
|Sets this form's full name.
|-


'''float Function [[GetWeight - Form|GetWeight]]()'''
|[[GetWeight - Form|Float '''GetWeight'''()]]
*Returns this form's weight.
|Returns this form's weight.
|-


'''Function [[SetWeight - Form|SetWeight]](float weight)'''
|[[SetWeight - Form|'''SetWeight'''(Float ''weight'')]]
*Sets this form's weight.
|Sets this form's weight.
|-


'''Function [[SetGoldValue - Form|SetGoldValue]](int value)'''
|[[SetGoldValue - Form|'''SetGoldValue'''(Int ''value'')]]
*Sets this form's base gold value.
|Sets this form's base gold value.
|-


'''int Function [[GetNumKeywords - Form|GetNumKeywords]]()'''
|[[GetNumKeywords - Form|Int '''GetNumKeywords'''()]]
*Returns the number of keywords on this form.
|Returns the number of keywords on this form.
|-


'''Keyword Function [[GetNthKeyword - Form|GetNthKeyword]](int index)'''
|[[GetNthKeyword - Form|Keyword '''GetNthKeyword'''(Int ''index'')]]
*Returns the keyword specified by index on this form.
|Returns the keyword specified by index on this form.
|-


'''bool Function [[HasKeywordString - Form|HasKeywordString]](string s)'''
|[[HasKeywordString - Form|Bool '''HasKeywordString'''(String ''s'')]]
*Returns whether this form has a keyword with the specified string.
|Returns whether this form has a keyword with the specified string.
|-


'''Function [[RegisterForKey - Form|RegisterForKey]](int keyCode)'''
|[[RegisterForKey - Form|'''RegisterForKey'''(Int ''keyCode'')]]
*Registers the given [[Input_Script#DXScanCodes|DXScanCode]] for OnKeyDown and OnKeyUp events.
|Registers the given [[Input_Script#DXScanCodes|DXScanCode]] for OnKeyDown and OnKeyUp events.
|-


'''Function [[UnregisterForKey - Form|UnregisterForKey]](int keyCode)'''
|[[UnregisterForKey - Form|'''UnregisterForKey'''(Int ''keyCode'')]]
*Unregisters the given [[Input_Script#DXScanCodes|DXScanCode]] for OnKeyDown and OnKeyUp events.
|Unregisters the given [[Input_Script#DXScanCodes|DXScanCode]] for OnKeyDown and OnKeyUp events.
|-


'''Function [[UnregisterForAllKeys - Form|UnregisterForAllKeys]]()'''
|[[UnregisterForAllKeys - Form|'''UnregisterForAllKeys'''()]]
*Unregisters all registered [[Input_Script#DXScanCodes|DXScanCodes]].
|Unregisters all registered [[Input_Script#DXScanCodes|DXScanCodes]].
|-


'''Function [[RegisterForControl - Form|RegisterForControl]](string control)'''
|[[RegisterForControl - Form|'''RegisterForControl'''(String ''control'')]]
*Registers the given control for OnControlDown and OnControlUp events.
|Registers the given control for OnControlDown and OnControlUp events.
|-


'''Function [[UnregisterForControl - Form|UnregisterForControl]](string control)'''
|[[UnregisterForControl - Form|'''UnregisterForControl'''(String ''control'')]]
*Unregisters the given control for OnControlDown and OnControlUp events.
|Unregisters the given control for OnControlDown and OnControlUp events.
|-


'''Function [[UnregisterForAllControls - Form|UnregisterForAllControls]]()'''
|[[UnregisterForAllControls - Form|'''UnregisterForAllControls'''()]]
*Unregisters all registered controls.
|Unregisters all registered controls.
|-


'''Function [[RegisterForMenu - Form|RegisterForMenu]](string menuName)'''
|[[RegisterForMenu - Form|'''RegisterForMenu'''(String ''menuName'')]]
*Registers for OnMenuOpen and OnMenuClose events for the given menu.
|Registers for OnMenuOpen and OnMenuClose events for the given menu.
|-


'''Function [[UnregisterForMenu - Form|UnregisterForMenu]](string menuName)'''
|[[UnregisterForMenu - Form|'''UnregisterForMenu'''(String ''menuName'')]]
*Unregisters for OnMenuOpen and OnMenuClose events for the given menu.
|Unregisters for OnMenuOpen and OnMenuClose events for the given menu.
|-


'''Function [[UnregisterForAllMenus - Form|UnregisterForAllMenus]]()'''
|[[UnregisterForAllMenus - Form|'''UnregisterForAllMenus'''()]]
*Unregisters all registered menus.
|Unregisters all registered menus.
|-


'''Function [[RegisterForModEvent - Form|RegisterForModEvent]](string eventName, string callbackName)'''
|[[RegisterForModEvent - Form|'''RegisterForModEvent'''(String ''eventName'', String ''callbackName'')]]
*Registers a custom event callback for given event name.
|Registers a custom event callback for given event name.
|-


'''Function [[SendModEvent - Form|SendModEvent]](string eventName, string strArg = "", float numArg = 0.0)'''
|[[SendModEvent - Form|'''SendModEvent'''(String ''eventName'', String ''strArg'', Float ''numArg'')]]
*Sends a custom event with given generic parameters.
|Sends a custom event with given generic parameters.
|-


'''Function [[UnregisterForModEvent - Form|UnregisterForModEvent]](string eventName)'''
|[[UnregisterForModEvent - Form|'''UnregisterForModEvent'''(String ''eventName'')]]
*Unregisters a custom event callback for given event name.
|Unregisters a custom event callback for given event name.
|-


'''Function [[UnregisterForAllModEvents - Form|UnregisterForAllModEvents]]()'''
|[[UnregisterForAllModEvents - Form|'''UnregisterForAllModEvents'''()]]
*Unregisters all registered custom events.
|Unregisters all registered custom events.
|-


'''Form Function [[TempClone - Form|TempClone]]()'''
|[[TempClone - Form|Form '''TempClone'''()]]
*Returns a temporary clone of this form
|Returns a temporary clone of this form
|-


'''Function [[RegisterForCameraState - Form|RegisterForCameraState]]()'''
|[[RegisterForCameraState - Form|'''RegisterForCameraState'''()]]
*Registers for OnPlayerCameraState events.
|Registers for OnPlayerCameraState events.
|-


'''Function [[UnregisterForCameraState - Form|UnregisterForCameraState]]()'''
|[[UnregisterForCameraState - Form|'''UnregisterForCameraState'''()]]
*Unregisters for OnPlayerCameraState events.
|Unregisters for OnPlayerCameraState events.
|-


'''Function [[RegisterForCrosshairRef - Form|RegisterForCrosshairRef]]()'''
|[[RegisterForCrosshairRef - Form|'''RegisterForCrosshairRef'''()]]
*Registers for OnCrosshairRefChange events.
|Registers for OnCrosshairRefChange events.
|-


'''Function [[UnregisterForCrosshairRef - Form|UnregisterForCrosshairRef]]()'''
|[[UnregisterForCrosshairRef - Form|'''UnregisterForCrosshairRef'''()]]
*Unregisters for OnCrosshairRefChange events.
|Unregisters for OnCrosshairRefChange events.
|-


'''Function [[RegisterForActorAction - Form|RegisterForActorAction]](int actionType)'''
|[[RegisterForActorAction - Form|'''RegisterForActorAction'''(Int ''actionType'')]]
*Registers for OnActorAction events.
|Registers for OnActorAction events.
|-


'''Function [[UnregisterForActorAction - Form|UnregisterForActorAction]](int actionType)'''
|[[UnregisterForActorAction - Form|'''UnregisterForActorAction'''(Int ''actionType'')]]
*Unregisters for OnActorAction events.
|Unregisters for OnActorAction events.
|-
 
|}


== Events ==
== Events ==
'''Event [[OnAnimationEvent - Form|OnAnimationEvent]](ObjectReference akSource, string asEventName)'''
*Received when one of animation events we are listening for is recieved.


'''Event [[OnAnimationEventUnregistered - Form|OnAnimationEventUnregistered]](ObjectReference akSource, string asEventName)'''
{|class="wikitable" width =100%
*Received when one of the animation events we are listening for has been automatically unregistered by the game due to the target animation graph unloading.
!style="text-align:left;"|Function
!style="text-align:left;"|Description
|-
|[[OnAnimationEvent - Form|'''OnAnimationEvent'''(ObjectReference ''akSource'', String ''asEventName'')]]
|Received when one of animation events we are listening for is recieved.
|-


'''Event [[OnGainLOS - Form|OnGainLOS]](Actor akViewer, ObjectReference akTarget)'''
|[[OnAnimationEventUnregistered - Form|'''OnAnimationEventUnregistered'''(ObjectReference ''akSource'', String ''asEventName'')]]
*Received when the viewer goes from not seeing the target to seeing the target - if this form is registered.
|Received when one of the animation events we are listening for has been automatically unregistered by the game due to the target animation graph unloading.
|-


'''Event [[OnLostLOS - Form|OnLostLOS]](Actor akViewer, ObjectReference akTarget)'''
|[[OnGainLOS - Form|'''OnGainLOS'''(Actor ''akViewer'', ObjectReference ''akTarget'')]]
*Received when the viewer goes from seeing the target to not seeing the target - if this form is registered.
|Received when the viewer goes from not seeing the target to seeing the target - if this form is registered.
|-


'''Event [[OnSleepStart - Form|OnSleepStart]](float afSleepStartTime, float afDesiredSleepEndTime)'''
|[[OnLostLOS - Form|'''OnLostLOS'''(Actor ''akViewer'', ObjectReference ''akTarget'')]]
*Received when the player goes to sleep.
|Received when the viewer goes from seeing the target to not seeing the target - if this form is registered.
|-


'''Event [[OnSleepStop - Form|OnSleepStop]](bool abInterrupted)'''
|[[OnSleepStart - Form|'''OnSleepStart'''(Float ''afSleepStartTime'', Float ''afDesiredSleepEndTime'')]]
*Received when the player wakes up or is interrupted in sleep.
|Received when the player goes to sleep.
|-


'''Event [[OnTrackedStatsEvent - Form|OnTrackedStatsEvent]](string asStat, int aiStatValue)'''
|[[OnSleepStop - Form|'''OnSleepStop'''(Bool ''abInterrupted'')]]
*Received when tracked stats are updated.
|Received when the player wakes up or is interrupted in sleep.
|-


'''Event [[OnUpdate - Form|OnUpdate]]()'''
|[[OnTrackedStatsEvent - Form|'''OnTrackedStatsEvent'''(String ''asStat'', Int ''aiStatValue'')]]
*Received at periodic intervals, if the form is registered.
|Received when tracked stats are updated.
|-


'''Event [[OnUpdateGameTime - Form|OnUpdateGameTime]]()'''
|[[OnUpdate - Form|'''OnUpdate'''()]]
*Received at periodic intervals of game time, if the form is registered.
|Received at periodic intervals, if the form is registered.
|-
 
|[[OnUpdateGameTime - Form|'''OnUpdateGameTime'''()]]
|Received at periodic intervals of game time, if the form is registered.
|-
 
|}


== SKSE Events ==
== SKSE Events ==


'''Event [[OnKeyDown - Form|OnKeyDown]](int keyCode)'''
{|class="wikitable" width =100%
*Received when key(s) registered via [[RegisterForKey - Form|RegisterForKey]] are pressed.
!style="text-align:left;"|Function
!style="text-align:left;"|Description
|-
|[[OnKeyDown - Form|'''OnKeyDown'''(Int ''keyCode'')]]
|Received when key(s) registered via [[RegisterForKey - Form|RegisterForKey]] are pressed.
|-
 
|[[OnKeyUp - Form|'''OnKeyUp'''(Int ''keyCode'', Float ''holdTime'')]]
|Received when key(s) registered via [[RegisterForKey - Form|RegisterForKey]] are released.
|-


'''Event [[OnKeyUp - Form|OnKeyUp]](int keyCode, float holdTime)'''
|[[OnControlDown - Form|'''OnControlDown'''(String ''control'')]]
*Received when key(s) registered via [[RegisterForKey - Form|RegisterForKey]] are released.
|Received when control(s) registered via [[RegisterForControl - Form|RegisterForControl]] are pressed.
|-


'''Event [[OnControlDown - Form|OnControlDown]](string control)'''
|[[OnControlUp - Form|'''OnControlUp'''(String ''control'', Float ''holdTime'')]]
*Received when control(s) registered via [[RegisterForControl - Form|RegisterForControl]] are pressed.
|Received when control(s) registered via [[RegisterForControl - Form|RegisterForControl]] are released.
|-


'''Event [[OnControlUp - Form|OnControlUp]](string control, float holdTime)'''
|[[OnMenuOpen - Form|'''OnMenuOpen'''(String ''menuName'')]]
*Received when control(s) registered via [[RegisterForControl - Form|RegisterForControl]] are released.
|Received when menu(s) registered via [[RegisterForMenu - Form|RegisterForMenu]] are opened.
|-


'''Event [[OnMenuOpen - Form|OnMenuOpen]](string menuName)'''
|[[OnMenuClose - Form|'''OnMenuClose'''(String ''menuName'')]]
*Received when menu(s) registered via [[RegisterForMenu - Form|RegisterForMenu]] are opened.
|Received when menu(s) registered via [[RegisterForMenu - Form|RegisterForMenu]] are closed.
|-


'''Event [[OnMenuClose - Form|OnMenuClose]](string menuName)'''
|[[OnPlayerCameraState - Form|'''OnPlayerCameraState'''(Int ''oldState'', Int ''newState'')]]
*Received when menu(s) registered via [[RegisterForMenu - Form|RegisterForMenu]] are closed.
|Received when (player camera state changes?) when registered via [[RegisterForCameraState - Form|RegisterForCameraState]]
|-


'''Event [[OnPlayerCameraState - Form|OnPlayerCameraState]](int oldState, int newState)'''
|[[OnCrosshairRefChange - Form|'''OnCrosshairRefChange'''(ObjectReference ''ref'')]]
*Received when (player camera state changes?) when registered via [[RegisterForCameraState - Form|RegisterForCameraState]]
|Received when player crosshair changes when registered via [[RegisterForCrosshairRef - Form|RegisterForCrosshairRef]] (Note: ref is none for no target)(Note:Crosshair uses activate pick)
|-


'''Event [[OnCrosshairRefChange - Form|OnCrosshairRefChange]](ObjectReference ref)'''
|[[OnActorAction - Form|'''OnActorAction'''(Int ''actionType'', Actor ''akActor'', Form ''source'', Int ''slot'')]]
*Received when player crosshair changes when registered via [[RegisterForCrosshairRef - Form|RegisterForCrosshairRef]] (Note: ref is none for no target)(Note:Crosshair uses activate pick)
|Received when the Actor performs an action that is registered via [[RegisterForActorAction - Form|RegisterForActorAction]]
|-


'''Event [[OnActorAction - Form|OnActorAction]](int actionType, Actor akActor, Form source, int slot)'''
|}
*Received when the Actor performs an action that is registered via [[RegisterForActorAction - Form|RegisterForActorAction]]

Navigation menu