Difference between revisions of "Form Script"

From the CreationKit Wiki
Jump to navigation Jump to search
imported>CraftySentinel
m (Formatting Change)
imported>CraftySentinel
m (→‎SKSE Member Functions: Fixed SendModEvent broken Link)
Line 196: Line 196:
|-
|-


|[[SendModEvent - Form|'''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.
|-
|-
Line 204: Line 204:
|-
|-


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

Revision as of 21:59, 26 October 2013


Native base script for every form in the game.

Definition

ScriptName Form

Properties

None

Global Functions

None

Member Functions

Function Description
Int GetFormID() Returns this form's form ID.
Int GetGoldValue() Returns this form's value in gold.
Bool HasKeyword(Keyword akKeyword) Returns if this form has the specified Keyword attached.
Bool PlayerKnows() Is the "Known" flag set on the form?
RegisterForAnimationEvent(ObjectReference akSender, String asEventName) Registers this form to receive the specified animation event from the specified object.
RegisterForLOS(Actor akViewer, ObjectReference akTarget) Registers this form to receive gain and lost LOS events between the viewer and the target.
RegisterForSingleLOSGain(Actor akViewer, ObjectReference akTarget) Registers this form to receive a single LOS gain event when the viewer sees the target.
RegisterForSingleLOSLost(Actor akViewer, ObjectReference akTarget) Registers this form to receive a single LOS lost event when the viewer loses sight of the target.
RegisterForSingleUpdate(Float afInterval) Registers this form to receive a single update event in the specified time.
RegisterForSingleUpdateGameTime(Float afInterval) Registers this form to receive a single update event in the specified number of game hours.
RegisterForSleep() Registers this form to receive sleep events for when the player goes to sleep or wakes up.
RegisterForTrackedStatsEvent() Registers this form to receive tracked stats events for when tracked stats are updated.
RegisterForUpdate(Float afInterval) Registers this form to receive update events with the specified interval, or changes the update interval.
RegisterForUpdateGameTime(Float afInterval) Registers this form to receive update events with the specified interval in game time hours, or changes the update interval.
StartObjectProfiling() Starts profiling all scripts attached to this form.
StopObjectProfiling() Stops profiling all scripts attached to this form.
UnregisterForAnimationEvent(ObjectReference akSender, String asEventName) Unregisters this from from receiving the specified animation event from the specified object.
UnregisterForLOS(Actor akViewer, ObjectReference akTarget) Unregisters this form from any LOS events between the viewer and target.
UnregisterForSleep() Unregisters this form from sleep events.
UnregisterForTrackedStatsEvent() Unregisters this form from tracked stats events.
UnregisterForUpdate() Unregisters this form from update events.
UnregisterForUpdateGameTime() Unregisters this form from game time update events.

SKSE Member Functions

Function Description
Int GetType() Returns this form's form typecode.
String GetName() Returns this form's full name.
SetName(String name) Sets this form's full name.
Float GetWeight() Returns this form's weight.
SetWeight(Float weight) Sets this form's weight.
SetGoldValue(Int value) Sets this form's base gold value.
Int GetNumKeywords() Returns the number of keywords on this form.
Keyword GetNthKeyword(Int index) Returns the keyword specified by index on this form.
Bool HasKeywordString(String s) Returns whether this form has a keyword with the specified string.
RegisterForKey(Int keyCode) Registers the given DXScanCode for OnKeyDown and OnKeyUp events.
UnregisterForKey(Int keyCode) Unregisters the given DXScanCode for OnKeyDown and OnKeyUp events.
UnregisterForAllKeys() Unregisters all registered DXScanCodes.
RegisterForControl(String control) Registers the given control for OnControlDown and OnControlUp events.
UnregisterForControl(String control) Unregisters the given control for OnControlDown and OnControlUp events.
UnregisterForAllControls() Unregisters all registered controls.
RegisterForMenu(String menuName) Registers for OnMenuOpen and OnMenuClose events for the given menu.
UnregisterForMenu(String menuName) Unregisters for OnMenuOpen and OnMenuClose events for the given menu.
UnregisterForAllMenus() Unregisters all registered menus.
RegisterForModEvent(String eventName, String callbackName) Registers a custom event callback for given event name.
SendModEvent(String eventName, String strArg, Float numArg) Sends a custom event with given generic parameters.
UnregisterForModEvent(String eventName) Unregisters a custom event callback for given event name.
UnregisterForAllModEvents() Unregisters all registered custom events.
Form TempClone() Returns a temporary clone of this form
RegisterForCameraState() Registers for OnPlayerCameraState events.
UnregisterForCameraState() Unregisters for OnPlayerCameraState events.
RegisterForCrosshairRef() Registers for OnCrosshairRefChange events.
UnregisterForCrosshairRef() Unregisters for OnCrosshairRefChange events.
RegisterForActorAction(Int actionType) Registers for OnActorAction events.
UnregisterForActorAction(Int actionType) Unregisters for OnActorAction events.

Events

Function Description
OnAnimationEvent(ObjectReference akSource, String asEventName) Received when one of animation events we are listening for is recieved.
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.
OnGainLOS(Actor akViewer, ObjectReference akTarget) Received when the viewer goes from not seeing the target to seeing the target - if this form is registered.
OnLostLOS(Actor akViewer, ObjectReference akTarget) Received when the viewer goes from seeing the target to not seeing the target - if this form is registered.
OnSleepStart(Float afSleepStartTime, Float afDesiredSleepEndTime) Received when the player goes to sleep.
OnSleepStop(Bool abInterrupted) Received when the player wakes up or is interrupted in sleep.
OnTrackedStatsEvent(String asStat, Int aiStatValue) Received when tracked stats are updated.
OnUpdate() Received at periodic intervals, if the form is registered.
OnUpdateGameTime() Received at periodic intervals of game time, if the form is registered.

SKSE Events

Function Description
OnKeyDown(Int keyCode) Received when key(s) registered via RegisterForKey are pressed.
OnKeyUp(Int keyCode, Float holdTime) Received when key(s) registered via RegisterForKey are released.
OnControlDown(String control) Received when control(s) registered via RegisterForControl are pressed.
OnControlUp(String control, Float holdTime) Received when control(s) registered via RegisterForControl are released.
OnMenuOpen(String menuName) Received when menu(s) registered via RegisterForMenu are opened.
OnMenuClose(String menuName) Received when menu(s) registered via RegisterForMenu are closed.
OnPlayerCameraState(Int oldState, Int newState) Received when (player camera state changes?) when registered via RegisterForCameraState
OnCrosshairRefChange(ObjectReference ref) Received when player crosshair changes when registered via RegisterForCrosshairRef (Note: ref is none for no target)(Note:Crosshair uses activate pick)
OnActorAction(Int actionType, Actor akActor, Form source, Int slot) Received when the Actor performs an action that is registered via RegisterForActorAction