Skip to content

WireButton

A button to press with Interact (E) with the mouse over it, or while standing on it. Its output “On” is 1 while it’s on: wire it to a lamp, a thruster, a gate.

Part of the Contraptions module: Contraptions, Garry’s Mod and Wiremod style: building tools used while the game runs (SandboxTools), welds, ropes and thrusters, wiring with buttons, sensors, gates, lamps and displays, and the Contraption template.

Requires: Collider (where it’s pressed)

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.

  • toggle: true or false = true. Each press flips it on or off. Untick it for a button that’s only on while it’s held down. (Field: on or off.)
  • isOn: true or false = false. True while it’s on. (Field: on or off.)
  • onTint: a color, “#RRGGBB” or “#RRGGBBAA” = “#57D36BFF”. The color its sprite turns while it’s on. Transparent leaves it alone. (Field: a color.)
  • sound: text = null. A sound played when it’s pressed. (A sound in Assets, e.g. “Sounds/hit.wav”.) (Field: a sound.)

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”).

  • Press. Presses it as a player does: a toggle flips on or off, and one that’s only on while held is on for a moment (a pulse down its wires). A trigger, a card or a note on the beat can press it.

What anything can read with no code: a Counter’s, Bar’s or Text’s output, a Contraptions Wire’s output as its signal; Text shows names too, the rest read numbers, true as 1.

  • On (true or false). True while it’s on.

Scripts use it as WireButton: its methods, events and values that aren’t saved with the scene.