SetJohnnyOnCrosshairEventHandler

From GECK
Jump to: navigation, search


A function added by the JohnnyGuitar NVSE Plugin.

Description

Sets/removes the specified UDF Script as a handler that will be invoked whenever the activation prompt appears on the object. Base Forms, references and formlists are accepted as filters, as well as Form Type IDs. When invoked, the script receives one argument: reference under crosshair.

Syntax

[help]
SetJohnnyOnCrosshairEventHandler setORremove:1/0 handlerScript:ref flag:int form:filter formType:filter 

Or:

SetOnCrosshairEventHandler setORremove:1/0 handlerScript:ref flag:int form:filter formType:filter

Example

SetJohnnyOnCrosshairEventHandler 1 OnCrosshairUDF 0 rActor

Sets the OnCrosshairUDF script as a handler to be invoked when rActor is under crosshair.

SetJohnnyOnCrosshairEventHandler 0 OnCrosshairUDF 0 rActor

Removes the OnCrosshairUDF script as a handler of the above.

SetJohnnyOnCrosshairEventHandler 1 OnCrosshairUDF 0 xMarker 27

Sets the OnCrosshairUDF script as a handler to be invoked when any Container is under crosshair. xMarker is used as stub argument to allow use of second filter without first.

Handler Script

A skeleton handler script for this event:

scn OnCrosshairUDF

ref rForm

begin Function {rForm} 

...

end

Notes

  • Compared to other crosshair events, this one runs before the activation prompt is loaded, so any manipulations with the form will be reflected on activation prompt.
  • Event must be registered in GameMode block (not MenuMode 4) as it is flushed every game load. This also means GetGameRestarted is NOT a viable option to set this event for the session. Instead consider using GetGameLoaded to (re)set the event handler.
  • Flag argument is reserved for future use and should always be 0.

See Also