Limits and safety Conteúdo

Plugins

Limits and safety

Time and call limits, switching off, the sandbox, sizes, undo, and what language editions translate.

Time and calls

Every event a plugin handles is bounded, so a slow or broken plugin can't hold up a turn:

LimitWhat it covers
50 msThe plugin's own work for one event (its code running, not the time it waits on the world).
40 callsCalls that reach the world for one event: the storyteller's tools, tells, cards, the clock, places, people, stores, character actions. wt.t, wt.dice, wt.config and wt.log don't count.
8 secondsOne event in all, waiting included.
2 questionswt.ask per event.

Past any of these, the listener is stopped where it is: what it had already done stands, and the turn goes on. What it did shows the run, and why it stopped.

Switched off after five stops

A plugin stopped five times in an hour (too slow, too many calls, or its thread had to be replaced) is switched off. The Plugins tab shows it off, with the reason; fix it, then switch it back on. An ordinary error thrown in a listener is logged in What it did and doesn't count towards the five.

What a plugin can't reach

Plugins run in a sandbox, on threads of their own. They have no network, no files, no imports and no timers. They have no real clock (Date is the moment of the event) and no real randomness (Math.random and wt.dice are seeded from the turn, so the same moment rolls the same way again). A plugin changes the world only through wt, and only in its own world: its stores, places, people and characters are that world's. Its calls to the storyteller's tools get the same checks the storyteller's own do.

Sizes

WhatAt most
Plugins in one world20
One plugin's code64 KB
A plugin's store on one character16 KB
One stored value (world or shared)32 KB
Keys one plugin keeps in a world2,000
A plugin's setting values16 KB
A fact told to the storyteller2,000 characters
A standing line400 characters
A carda title of 120 characters, a body of 2,000, four buttons
A sheet section12 lines
Questions after a scene, all plugins together12
Events setting off events3 deep
Rerolls of one roll3

Undo

Undo doesn't reverse what plugins do, yet. A turn in which a plugin changed anything is marked, and undo refuses it, naming the plugin and what it did. A change a plugin made outside a turn (a new day, a timer, a button) also stops undo of the turns before it.

Language editions

A language edition runs its source world's plugins: the code is the source's, byte for byte, and it is changed only in the source world. What an edition translates is each plugin's name, what it does, and its words players see, the strings read with wt.t.

What isn't translated: the code and the settings. Text written straight into the code, and a setting that matches places by name, stay as they were written. So put every word players read in strings. Facts for the storyteller may be in any language: it writes in the world's language anyway.

Who can write them

Plugins are in Beta: for now only Worldtable's operators can save, change or try them, and they open to every builder later. Every save loads each plugin in the sandbox first and runs its onEnable; a plugin that doesn't load isn't saved, and the problem comes back in words.