Form Script: Difference between revisions

Jump to navigation Jump to search
582 bytes removed ,  2 February 2014
Reverted to List
imported>CraftySentinel
m (→‎SKSE Member Functions: Fixed SendModEvent broken Link)
imported>CraftySentinel
(Reverted to List)
Line 1: Line 1:
[[Category:Scripting]]
[[Category:Papyrus]]
[[Category:Script Objects]]
[[Category:SKSE]]
[[Category:SKSE Script Objects]]
Native base script for every [[Glossary#Form|form]] in the game.
Native base script for every [[Glossary#Form|form]] in the game.


Line 20: Line 14:
== Member Functions ==
== Member Functions ==


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


|[[GetGoldValue - Form|Int '''GetGoldValue'''()]]
:'''Int [[GetGoldValue - Form|GetGoldValue]]()'''
|Returns this form's value in gold.
:*Returns this form's value in gold.
|-


|[[HasKeyword - Form|Bool '''HasKeyword'''(Keyword ''akKeyword'')]]
:'''Bool [[HasKeyword - Form|HasKeyword]](Keyword ''akKeyword'')'''
|Returns if this form has the specified [[Keyword Script|Keyword]] attached.
:*Returns if this form has the specified [[Keyword Script|Keyword]] attached.
|-


|[[PlayerKnows - Form|Bool '''PlayerKnows'''()]]
:'''Bool [[PlayerKnows - Form|PlayerKnows]]()'''
|Is the "Known" flag set on the form?
:*Is the "Known" flag set on the form?
|-


|[[RegisterForAnimationEvent - Form|'''RegisterForAnimationEvent'''(ObjectReference ''akSender'', String ''asEventName'')]]
:'''[[RegisterForAnimationEvent - Form|RegisterForAnimationEvent]](ObjectReference ''akSender'', String ''asEventName'')'''
|Registers this form to receive the specified animation event from the specified object.
:*Registers this form to receive the specified animation event from the specified object.
|-


|[[RegisterForLOS - Form|'''RegisterForLOS'''(Actor ''akViewer'', ObjectReference ''akTarget'')]]
:'''[[RegisterForLOS - Form|RegisterForLOS]](Actor ''akViewer'', ObjectReference ''akTarget'')'''
|Registers this form to receive gain and lost LOS events between the viewer and the target.
:*Registers this form to receive gain and lost LOS events between the viewer and the target.
|-


|[[RegisterForSingleLOSGain - Form|'''RegisterForSingleLOSGain'''(Actor ''akViewer'', ObjectReference ''akTarget'')]]
:'''[[RegisterForSingleLOSGain - Form|RegisterForSingleLOSGain]](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 a single LOS gain event when the viewer sees the target.
|-


|[[RegisterForSingleLOSLost - Form|'''RegisterForSingleLOSLost'''(Actor ''akViewer'', ObjectReference ''akTarget'')]]
:'''[[RegisterForSingleLOSLost - Form|RegisterForSingleLOSLost]](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 lost event when the viewer loses sight of the target.
|-


|[[RegisterForSingleUpdate - Form|'''RegisterForSingleUpdate'''(Float ''afInterval'')]]
:'''[[RegisterForSingleUpdate - Form|RegisterForSingleUpdate]](Float ''afInterval'')'''
|Registers this form to receive a single update event in the specified time.
:*Registers this form to receive a single update event in the specified time.
|-


|[[RegisterForSingleUpdateGameTime - Form|'''RegisterForSingleUpdateGameTime'''(Float ''afInterval'')]]
:'''[[RegisterForSingleUpdateGameTime - Form|RegisterForSingleUpdateGameTime]](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 number of game hours.
|-


|[[RegisterForSleep - Form|'''RegisterForSleep'''()]]
:'''[[RegisterForSleep - Form|RegisterForSleep]]()'''
|Registers this form to receive sleep events for when the player goes to sleep or wakes up.
:*Registers this form to receive sleep events for when the player goes to sleep or wakes up.
|-


|[[RegisterForTrackedStatsEvent - Form|'''RegisterForTrackedStatsEvent'''()]]
:'''[[RegisterForTrackedStatsEvent - Form|RegisterForTrackedStatsEvent]]()'''
|Registers this form to receive tracked stats events for when tracked stats are updated.
:*Registers this form to receive tracked stats events for when tracked stats are updated.
|-


|[[RegisterForUpdate - Form|'''RegisterForUpdate'''(Float ''afInterval'')]]
:'''[[RegisterForUpdate - Form|RegisterForUpdate]](Float ''afInterval'')'''
|Registers this form to receive update events with the specified interval, or changes the update interval.
:*Registers this form to receive update events with the specified interval, or changes the update interval.
|-


|[[RegisterForUpdateGameTime - Form|'''RegisterForUpdateGameTime'''(Float ''afInterval'')]]
:'''[[RegisterForUpdateGameTime - Form|RegisterForUpdateGameTime]](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 in game time hours, or changes the update interval.
|-


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


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


|[[UnregisterForAnimationEvent - Form|'''UnregisterForAnimationEvent'''(ObjectReference ''akSender'', String ''asEventName'')]]
:'''[[UnregisterForAnimationEvent - Form|UnregisterForAnimationEvent]](ObjectReference ''akSender'', String ''asEventName'')'''
|Unregisters this from from receiving the specified animation event from the specified object.
:*Unregisters this from from receiving the specified animation event from the specified object.
|-


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


|[[UnregisterForSleep - Form|'''UnregisterForSleep'''()]]
:'''[[UnregisterForSleep - Form|UnregisterForSleep]]()'''
|Unregisters this form from sleep events.
:*Unregisters this form from sleep events.
|-


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


|[[UnregisterForUpdate - Form|'''UnregisterForUpdate'''()]]
:'''[[UnregisterForUpdate - Form|UnregisterForUpdate]]()'''
|Unregisters this form from update events.
:*Unregisters this form from update events.
|-


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


|}


== SKSE Member Functions ==
== SKSE Member Functions ==


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


|[[GetName - Form|String '''GetName'''()]]
:'''String [[GetName - Form|GetName]]()'''
|Returns this form's full name.
:*Returns this form's full name.
|-


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


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


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


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


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


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


|[[HasKeywordString - Form|Bool '''HasKeywordString'''(String ''s'')]]
:'''Bool [[HasKeywordString - Form|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.
|-


|[[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.
|-


|[[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.
|-


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


|[[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.
|-


|[[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.
|-


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


|[[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.
|-


|[[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.
|-


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


|[[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.
|-


|[[SendModEvent|'''SendModEvent'''(String ''eventName'', String ''strArg'', Float ''numArg'')]]
:'''[[SendModEvent|SendModEvent]](String ''eventName'', String ''strArg'', Float ''numArg'')'''
|Sends a custom event with given generic parameters.
:*Sends a custom event with given generic parameters.
|-


|[[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.
|-


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


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


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


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


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


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


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


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


|}


== Events ==
== Events ==


{|class="wikitable" width =100%
:'''[[OnAnimationEvent - Form|OnAnimationEvent]](ObjectReference ''akSource'', String ''asEventName'')'''
!style="text-align:left;"|Function
:*Received when one of animation events we are listening for is recieved.
!style="text-align:left;"|Description
|-
|[[OnAnimationEvent - Form|'''OnAnimationEvent'''(ObjectReference ''akSource'', String ''asEventName'')]]
|Received when one of animation events we are listening for is recieved.
|-


|[[OnAnimationEventUnregistered - Form|'''OnAnimationEventUnregistered'''(ObjectReference ''akSource'', String ''asEventName'')]]
:'''[[OnAnimationEventUnregistered - Form|OnAnimationEventUnregistered]](ObjectReference ''akSource'', String ''asEventName'')'''
|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.
:*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.
|-


|[[OnGainLOS - Form|'''OnGainLOS'''(Actor ''akViewer'', ObjectReference ''akTarget'')]]
:'''[[OnGainLOS - Form|OnGainLOS]](Actor ''akViewer'', ObjectReference ''akTarget'')'''
|Received when the viewer goes from not seeing the target to 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.
|-


|[[OnLostLOS - Form|'''OnLostLOS'''(Actor ''akViewer'', ObjectReference ''akTarget'')]]
:'''[[OnLostLOS - Form|OnLostLOS]](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 seeing the target to not seeing the target - if this form is registered.
|-


|[[OnSleepStart - Form|'''OnSleepStart'''(Float ''afSleepStartTime'', Float ''afDesiredSleepEndTime'')]]
:'''[[OnSleepStart - Form|OnSleepStart]](Float ''afSleepStartTime'', Float ''afDesiredSleepEndTime'')'''
|Received when the player goes to sleep.
:*Received when the player goes to sleep.
|-


|[[OnSleepStop - Form|'''OnSleepStop'''(Bool ''abInterrupted'')]]
:'''[[OnSleepStop - Form|OnSleepStop]](Bool ''abInterrupted'')'''
|Received when the player wakes up or is interrupted in sleep.
:*Received when the player wakes up or is interrupted in sleep.
|-


|[[OnTrackedStatsEvent - Form|'''OnTrackedStatsEvent'''(String ''asStat'', Int ''aiStatValue'')]]
:'''[[OnTrackedStatsEvent - Form|OnTrackedStatsEvent]](String ''asStat'', Int ''aiStatValue'')'''
|Received when tracked stats are updated.
:*Received when tracked stats are updated.
|-


|[[OnUpdate - Form|'''OnUpdate'''()]]
:'''[[OnUpdate - Form|OnUpdate]]()'''
|Received at periodic intervals, if the form is registered.
:*Received at periodic intervals, if the form is registered.
|-


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


|}


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


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


|[[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.
|-


|[[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.
|-


|[[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.
|-


|[[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.
|-


|[[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]]
|-


|[[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)
|-


|[[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]]
|-


|[[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]]
|-


|}
[[Category:Scripting]]
[[Category:Papyrus]]
[[Category:Script Objects]]
[[Category:SKSE]]
[[Category:SKSE Script Objects]]

Navigation menu