Trigger
When a message arrives, does something with no code: “when Score arrives, Damage the Boss by 2”, “when Beat arrives, End Turn”, “when Matched arrives from Board A, Fire the Cannon”. It hears its Message (from anyone, or only from the entity named From) and does the action Do names on its Targets, or on its own entity without any: whatever their components can do (a switch’s On, a door’s Open, a spawner’s Spawn, a health’s Damage…; see each component’s actions), scripts’ own actions included. Give an entity a Trigger for each thing it reacts to. The Scene view draws a line from it to what it drives.
The action is done where the game is run: offline, or on the host of a network game (things only this player sees, such as their panels and sounds, on their own machine). A trigger can’t set itself off over and over in the same moment: a chain of triggers stops after a few steps.
Works with: MessageScope (on what sends the message, to tell two senders apart)
Properties
Section titled “Properties”Each is listed as its key in the scene file and the MCP tools, then its kind of value, its default and what it does.
message: text = null. The message it waits for, e.g. “Score” or “PlayerDied”: one a component sends, a dialogue’s [send], or a script’s Game.Send. (Names a message.) (Field: a name.)from: text = null. Only hear the message when this entity sent it (it, or something inside it, such as a goal on a board), e.g. “Board A”. Empty hears it from anyone. (Names an entity.) (Field: an entity’s name.)do: text = null. What to do, e.g. “Damage”, “Open” or “Spawn”: an action of the Targets’ components (or this entity’s). “Health.Damage” names one component’s when two have an action called the same; without that, every component with one does it. (Names an action of the entities targets names, or this entity without any: one component_describe lists under Actions, e.g. “Damage”, or “Health.Damage” for one component’s.) (Field: an action’s name.)targets: text = null. The entities to do it on, by name, separated by commas (those inside this one first). Empty does it on this entity. (Names entities: their names, separated by commas.) (Field: an entity’s name.)with: text = null. What to do it with, for an action that takes a value: how much (Damage 2), a name (Set Flag “MetGuide”) or true or false. Empty uses the action’s own default (1 for an amount). (The value the action do names is done with, as the action takes it: a number (“2”), true or false, or a name (a flag for Set Flag, a scene for Load Scene). Empty uses the action’s own default. The Inspector gives a box, a tick or a list as the action wants.) (Field: its own editor: Action Value.)useMessageNumber: true or false = false. Hear it with the message’s own number as the value, when it sends one (a beat’s number, the points scored), rather than With. (Field: on or off.)
Actions
Section titled “Actions”What anything can make it do with no code: a Trigger’s do when its message arrives, a Contraptions Wire’s input as its signal comes on, a script’s Game.Do(entity, “Name”).
SetFlag(done with a name, its flag: a trigger’s with). Sets flag in the game’s save data, as a dialogue’s “[set Flag]” does.ClearFlag(done with a name, its flag: a trigger’s with). Clears flag in the game’s save data, as a dialogue’s “[clear Flag]” does.LoadScene(done with a name, its scene: a trigger’s with). Goes to the scene named scene (e.g. “Ending”), fading out and in, as a button that loads one does: the end of a story, the next level once a boss is beaten.PlayMinigame(done with a name, its scene: a trigger’s with). Plays the scene named scene on top of this one as a minigame (e.g. “Arcade”), pausing the rest until it’s won or lost; then “Minigame Won” or “Minigame Lost” is sent from this entity, with the score. A Minigame on this entity says how instead (and an empty scene plays its own).WinMinigame(done with a whole number, its score: a trigger’s with, 0 without one). Wins the minigame this trigger is in, with score (0 takes the minigame’s own score: its first Score output, or its first counter’s count): it closes, and what opened it hears it was won.LoseMinigame(done with a whole number, its score: a trigger’s with, 0 without one). Loses the minigame this trigger is in, with score (0 takes the minigame’s own score).ForgetScene(done with a name, its scene: a trigger’s with). Forgets how the scene named scene was left (see RememberScene), so it starts as its file has it next time: the dungeon filling up again once the boss is beaten.
While the game runs
Section titled “While the game runs”Not saved with the scene; scripts read them, and entity_get shows them as live while the game plays.
fired: a whole number. How many times it has gone off.
Scripts use it as Trigger: its methods, events and values that aren’t saved with the scene.