mirror of
https://github.com/SillyTavern/Extension-ScriptEvents.git
synced 2026-10-15 13:32:03 +00:00
Allows setting app event listeners that execute STscript commands.
- JavaScript 100%
| index.js | ||
| LICENSE | ||
| manifest.json | ||
| README.md | ||
Script Events
Allows setting app event listeners that execute STscript commands.
Events are cleared when the SillyTavern page is refreshed or closed.
Usage
- Install the extension.
- Use
/event-on event=eventId {: closure code :}to set an event listener. Get the event ID using the autocomplete feature. The closure is an STscript command that will be executed when the event is triggered (string subcommands are not supported). The command returns a listener ID that can be used to remove the event listener.- Use
/var arg0to access the event argument, or/var arg0.keyto access a specific key if the argument is a map. - Array elements can be accessed by index key, e.g.
/var arg0.0for the first element.
- Use
- Use
/event-off listenerIdto remove an event listener. - Use
/event-onceto set a one-time event listener that will be removed after it is triggered.
Examples
Set an event listener that outputs a current chat name.
/event-on event=CHAT_CHANGED {: /var arg0 | /echo :}
License
AGPL-3.0