skymp
skymp copied to clipboard
Support ModEvent
Feature Request: Add support for the ModEvent
SKSE script:
https://www.creationkit.com/index.php?title=ModEvent_Script
Description
Right now the only way SKSE Mod Events are supported is via <Form|Alias|ActiveMagicEffect>.sendModEvent()
but that requires the Papyrus handler to match the signature string eventName, string strArg, float fltArg, Form sender
(you get to provide the string and float and the other 2 parameters are pre-populated by sendModEvent
).
ModEvent
is common to make handlers other single function signatures. For example, I never use sendModEvent
in my Papyrus applications, I always use ModEvent
.
This isn't a huge deal breaker for my applications, I'm just having to write custom Mod Event handlers for every SP-sent event and delegate it to my Papyrus mod's handler (which is written to use ModEvent
)
Found this "surprising" and hoped ModEvent
would be supported.
Low priority (for me), but would be awesome to have if it's also low effort to support! Thanks
We should enable this syntax, right?
import { ModEvent } from "skyrimPlatform";
function someFunction() {
let handle = ModEvent.create("ModPrefix_myCustomEvent");
if (handle) {
ModEvent.pushInt(handle, 1000);
ModEvent.pushString(handle, "It worked!");
ModEvent.send(handle);
}
}
Yes please! <3 <3 <3 <3 <3
@mrowrpurr
Just to know, does any
hack work?
import * as sp from "skyrimPlatform";
function someFunction() {
let handle = (sp as any).ModEvent.create("ModPrefix_myCustomEvent");
if (handle) {
(sp as any).ModEvent.pushInt(handle, 1000);
(sp as any).ModEvent.pushString(handle, "It worked!");
(sp as any).ModEvent.send(handle);
}
}
@Pospelove It did work! Thank you!
That's kind of a gross thing to have to do. Is there a way to provide the ModEvent
API without (sp as any).ModEvent
?
But thank you!!!
@mrowrpurr Yes there is so I'm keeping the issue open for now
It's hacky. We need to use (sp as any).ModEvent
and then press 9+O+L to generate FunctionsDump.txt
and then update FunctionsDump.txt
in the repo.
codegen of skyrimPlatform.ts
bases on this file. and this file is generated by hands in-game with 9OL key combination