scmJS docs

Spells

trigscript/spells lets a Medic cast Restoration on its own. A unit hit by Lockdown or Plague near an idle Medic is restored without the player clicking anything.

import { autoRestore } from "trigscript/spells";

autoRestore();   // at the top of the script: on for the whole game

A human player's Medic that stands idle, or is healing on its own after standing idle, casts Restoration on a unit within the spell's range that has Lockdown, Irradiate, Plague, Ensnare, Maelstrom, Acid Spores or Optical Flare. The unit is its owner's, or a player's its owner has set as an ally. Buildings are not restored.

Tied to a switch, keeping some energy. With switch, auto-restore runs only while that switch of the map is set, so a campaign map can give it to the player partway through. The name is one switches. lists: the map's own name for the switch, or "Switch 1" for one it has not named. A name the map does not have is an error when the script is built. With keepEnergy, a Medic casts only while it would have that much energy left afterwards:

import { autoRestore } from "trigscript/spells";

autoRestore({ switch: "Switch 1", keepEnergy: 25 });

Where the call goes. autoRestore() makes a program, so the call goes at the top of a script, outside program(). Inside program() or a listener it is an error at the call. Once is enough: a second call, in the same file or another, adds nothing, and its options are not used.

Name What it does
autoRestore(options?) Turn auto-restore on. Options: switch (a switch's name; it runs only while that switch is set) and keepEnergy (energy a Medic keeps after casting, 0 when left out). At the top of a script only.