Script API & versions

Everything is in MF.SimpleVisual. Members listed as stable follow the versioning policy; others are experimental.

Stable API

MF.SimpleVisual.VERSION → "0.8.0"
MF.SimpleVisual.FORMAT_VERSION → 1
MF.SimpleVisual.reload() → Promise<data>

Reloads data/SimpleVisual.json and re-applies it to the current scene.

MF.SimpleVisual.applyScene(scene?)

Re-applies the layout (default — current scene).

MF.SimpleVisual.layoutFor(scene?) → object | null

Resolved layout: inheritance, theme, preset and player settings.

MF.SimpleVisual.openCustomScene(id) → boolean
MF.SimpleVisual.setPreset(name | null)

registerAction

MF.SimpleVisual.registerAction(type, handler, meta?)

handler(action, context); return false — "not executed". meta describes the action for the editor picker.

MF.SimpleVisual.registerAction("openQuests", (action, ctx) => {
    SceneManager.push(Scene_Quests);
}, { label: { en: "Open quests", ru: "Открыть задания" }, group: "Plugins",
     fields: [{ key: "tab", input: "string", label: "Tab" }] });
input: integer string number boolean json enum (+ options).

Settings

Settings.get(key) → value | null
Settings.set(key, value, { save }?)

Keys: theme windowOpacity fontSize hudPosition. get returns null when the key is not allowed by the parameters.

Hud

Hud.show(id?) · Hud.hide(id?) · Hud.isHidden(id?) → boolean

Without id — the whole HUD. Stored in the save file.

PresetIO

PresetIO.exportPreset(name) → path
PresetIO.readPreset(file) → { name, preset }

NW.js only. Throws with a readable message. Imported presets are upgraded like the file (deprecated properties renamed).

Deprecated

Keeps old names working. Warnings go through MF.Deprecation: once per id, event mf:deprecated, owner MF_SimpleVisual.

Deprecated.warn(id, { since, removeIn, replacement, note })
Deprecated.method(obj, oldName, { since, removeIn, replacement, fn })

With fn — redirect to the new function; without — wraps the existing one.

Deprecated.property(obj, oldName, newName, info)
Deprecated.renameProp(scope, from, to, { since, removeIn, map })

Renames a file property on load. Scopes: root theme scene window element template sprite menuCommand command preset, "*" — all. Element rules also apply to hover / pressed / disabled. map(value, owner) converts the old value. If both names are present, the new one wins.

Deprecated.aliasAction(from, to, { since, removeIn, map })

Old action type runs as the new one (map(action) may adjust fields).

Deprecated.aliasElementType(from, to, { since, removeIn, map })
Deprecated.upgradeLayout(layout, path?) → layout

Applies all rules in place. Called by the loader and PresetIO.

Deprecated.list() → [{ id, since, removeIn, replacement, owner, count }]
Deprecated.rules() → { props, actions, elementTypes }
// Example: element property "label" renamed to "caption" in 0.9.0
Deprecated.renameProp("element", "label", "caption", { since: "0.9.0", removeIn: "1.0.0" });
// Console (once): SimpleVisual.json: element.label is deprecated since MF_SimpleVisual 0.9.0
//   and will be removed in 1.0.0. Use "caption" instead. First use: SimpleVisual.json.scenes.Scene_Map.elements[2].

Experimental members experimental

Used by the editor; may change in a MINOR release (listed as "Experimental change"): LayoutStore WindowPatcher SceneHook ElementFactory ActionRegistry Template Sources Presets Compat Resolution BattleLayout MenuCommands Scene_Custom ListAdapter CommandAdapter SpritePatcher Parents ThemeManager Fonts Mouse States Sounds SelfTokens MapTokens Dyn PictureDraw, schema constants (*_PROPS, *_TYPES), sanitize, setEditing.

Versioning policy

Semver, same rules as MF_Core.

ReleaseAllowed
PATCHBug fixes only
MINORNew API, properties, actions, element types; deprecations; experimental changes
MAJORRemoval of previously deprecated names only
  1. Replace — the new name is added; the old one keeps working through Deprecated with a one-time warning.
  2. Announce — changelog entry under Deprecated with since / removeIn.
  3. Remove — only in the stated release. Everything deprecated in 0.x works at least until 1.0.0.

Covers the script API, action types, element types and file properties. Renamed properties are upgraded on load; saving in the editor writes the new names.

Data format: an incompatible structure change raises FORMAT_VERSION and adds a migration vN → vN+1 (MF.Migration, key "SimpleVisual"). A file of a newer format is loaded with a warning.

Deprecated now

OldNewSinceRemove in
MF.UIEditorMF.SimpleVisual0.1.01.0.0
$dataUILayouts$dataSimpleVisual0.1.01.0.0
"layouts" (root)"scenes" (v0 migration)0.1.01.0.0

Dependent plugins

/*:
 * @base MF_SimpleVisual
 * @orderAfter MF_SimpleVisual
 * @help Requires: MF_SimpleVisual 0.8.0+ (written against 0.8.0)
 */
MF.Core.register("MF_MyPlugin", "1.0.0", { requires: { MF_Core: "1.1.0", MF_SimpleVisual: "0.8.0" } });

Use only the stable API — or pin the exact version if you rely on experimental members.

Error handling

SituationBehavior
File missingStandard look
File brokenStandard look, console error; the editor refuses to overwrite without confirmation
Newer formatLoaded with a warning
Unknown / invalid propertyIgnored, warned once
Expression errorStandard value, warning
Unknown action / failing actionSkipped, logged
Condition errorElement hidden, warned once
Deprecated nameWorks, warned once

Changelog

Full history with tags: CHANGELOG.md.