Write plugins
A plugin is a folder Wraith loads into a game. It can do everything a tweak can, and it can also have its own windows and settings.
Pick a language
Section titled “Pick a language”| TypeScript or JavaScript | Lua | Zig | |
|---|---|---|---|
| Good for | Most plugins | Small plugins, no tools needed | Heavy lifting, C libraries, threads |
| Needs | Node | Nothing | Zig |
| Builds to | One bundled main.js |
Nothing to build | A DLL for each arch |
| Reload | Rebuilds as you save | Reload | zig build, then reload |
They all get the same features. JS is the easy start, with types and autocomplete. Lua is the quickest to get going, since it’s just files in a folder. Pick Zig when speed matters or you want to pull in native code, like the screenshot plugin does for EXR.
TypeScript and JavaScript are the same thing here. The template is TypeScript, and --js gives you plain JavaScript with type checking from comments.
The manifest
Section titled “The manifest”Every plugin has a wraith.json at the top of its folder. The hub reads it too, and its schema is at https://hub.wraith.io/schema/v1/wraith.json.
{ "$schema": "https://hub.wraith.io/schema/v1/wraith.json", "id": "my-plugin", "kind": "plugin", "version": "0.1.0", "title": "My Plugin", "summary": "Does a thing.", "author": "You", "wraith": "0.4.0", "games": [{ "exe": "game.exe" }], "provider": "js"}id is the plugin’s name, and its folder’s. Use lowercase letters, digits, _ and -. wraith is the oldest Wraith it runs on.
Leave out games for any game. A game can be matched by its id, like steam-3316940, or its exe. builds lists the builds you tested on.
provider is "js" or "lua". Leave it out for Zig.
"arches": ["x64"] limits it to 64-bit games. Without it, Zig plugins build for both. "autoLoad": false keeps Wraith from loading it on its own.
depends lists plugins it needs, by id, like ["unity", "freecam@1.2"]. @ gives the oldest version that’ll do. Wraith loads them first, even ones with autoLoad off, and unloads your plugin before them. If one’s missing, too old or turned off, your plugin doesn’t load, and the log says what it needs. wraith plugins install gets them from the hub too. To share code and calls with them, see sharing for JS, Lua or Zig.
Loading your plugin
Section titled “Loading your plugin”Installed plugins live in Wraith’s plugins folder. While you’re working on one, point Wraith at its folder instead. For JS that’s the build output.
wraith dev add distThen open the overlay with Insert, go to Plugins and hit Rescan. After that, Reload picks up each new build. The CLI page has the other dev commands.
Made with ♥ by Asgard
