Create a free account to remove all ad content.

Author Topic:  [Blueprint] Button acting as a Switch  (Read 326 times)

0 Members and 1 Guest are viewing this topic.


  • Legendary Member
  • *
  • Posts: 1147
    • View Profile
[Blueprint] Button acting as a Switch
« on: December 31, 2014, 09:05:04 AM »
Button as a Switch

A simple script useful for toggling the state of anything, using a button.

I use variations of this script in a lot of reset scripts.
e.g. If IsBlock (or HasHistory) Then (toggle, wtvr).

It's also one of the easiest ways to toggle multiple lights on or off..
-A few scriptblocks around your house running one of these scripts will allow you to turn all the lights On or Off by pressing any one of the buttons, No Logic gates required.

The Script

-Run when scriptblock is powered On. When button is pressed

Code: [Select]
1. If
2.   IsPowered [xyz] [true]
3. Then
4.   SetPower [xyz] [off]
5. Else
6.   SetPower [xyz] [on]