Editing
ModEvent Script
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
__NOTOC__ {{SKSEFunction|1.7.0}} Script for ModEvents. == Definition == <syntaxhighlight lang="papyrus"> ScriptName ModEvent Hidden </syntaxhighlight> == SKSE Global Functions == :'''Int [[Create - ModEvent|Create]](String ''eventName'')''' :*Creates a new ModEvent and returns the handle. :'''Bool [[Send - ModEvent|Send]](Int ''handle'')''' :*Sends the ModEvent and releases it. (Return value indicates whether it was successfully sent). :'''Bool [[Release - ModEvent|Release]](Int ''handle'')''' :*Releases the ModEvent without sending it. :'''[[PushBool - ModEvent|PushBool]](Int ''handle'', Bool ''value'')''' :*Pushes a Bool param into the event. :'''[[PushInt - ModEvent|PushInt]](Int ''handle'', Int ''value'')''' :*Pushes a Int param into the event. :'''[[PushFloat - ModEvent|PushFloat]](Int ''handle'', Float ''value'')''' :*Pushes a Float param into the event :'''[[PushString - ModEvent|PushString]](Int ''handle'', String ''value'')''' :*Pushes a String param into the event. :'''[[PushForm - ModEvent|PushForm]](Int ''handle'', Form ''value'')''' :*Pushes a Form param into the event. == Example == Script that is sending the event: <syntaxhighlight lang=papyrus> 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 </syntaxhighlight> Script that wishes to receive the event: <syntaxhighlight lang=papyrus> 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 </syntaxhighlight> [[Category:Scripting]] [[Category:Papyrus]] [[Category:Script Objects]] [[Category:SKSE]] [[Category:SKSE Script Objects]]
Summary:
Please note that all contributions to the CreationKit Wiki are considered to be released under the Creative Commons Attribution-ShareAlike (see
CreationKit:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Template used on this page:
Template:SKSEFunction
(
edit
)
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
Namespaces
Page
Discussion
English
Views
Read
Edit
Edit source
View history
More
Search
Navigation
Landing page
Tutorials
Game Systems
Editor Reference
Scripting Reference
Recent changes
Help
Tools
What links here
Related changes
Special pages
Page information
Page values