ModEvent Script
Revision as of 15:17, 20 October 2014 by imported>Egocarib
Minimum required SKSE Version: 1.7.0
Script for ModEvents.
DefinitionEdit
ScriptName ModEvent Hidden
SKSE Global FunctionsEdit
- Int Create(String eventName)
- Creates a new ModEvent and returns the handle.
- Bool Send(Int handle)
- Sends the ModEvent and releases it. (Return value indicates whether it was successfully sent).
- Bool Release(Int handle)
- Releases the ModEvent without sending it.
- PushBool(Int handle, Bool value)
- Pushes a Bool param into the event.
- PushInt(Int handle, Int value)
- Pushes a Int param into the event.
- PushFloat(Int handle, Float value)
- Pushes a Float param into the event
- PushString(Int handle, String value)
- Pushes a String param into the event.
- PushForm(Int handle, Form value)
- Pushes a Form param into the event.
ExampleEdit
Script that is sending the event:
SomeFunction()
int handle = ModEvent.Create("ModPrefix_myCustomEvent")
if (handle)
ModEvent.PushForm(handle, self)
ModEvent.PushForm(handle, someOtherForm)
ModEvent.PushInt(handle, 1000)
ModEvent.PushString(handle, "It worked!")
ModEvent.Send(handle)
endIf
EndFunction
Script that wishes to receive the event:
Function OnInit()
RegisterForModEvent("ModPrefix_myCustomEvent", "OnMyCustomEvent") ;(remember to re-register for events each game reload)
EndFunction
;note that the parameters of this event must match the number & order of parameters as they were pushed in the sending script.
Event OnMyCustomEvent(Form sender, Form theForm, int theInt, string theString)
if (sender as Actor)
debug.trace("Our event was received from a script attached to an Actor!")
endif
int goldVal = someOtherForm.GetGoldValue()
debug.trace("The other form recieved by our event has a gold value of " + goldVal)
debug.trace("We recieved theInt, and it equals " + theInt)
debug.trace(theString) ;prints "It worked!"
EndEvent