Skip to content

Your first automation

In this guide you build an intruder alarm: when a player or mob walks up to a detector, an alarm sounds. It takes about ten minutes and you do not need to know how to program.

Item Recipe
1 Programmable Computer computer
1 Network Repeater (the recipe makes 2) repeater
1 Entity Detector detector
1 Alarm Module alarm
1 Linking Tool linking tool

All of them use iron, copper and redstone and can be made before your first trip to the Nether. In creative mode they are all in the FilaSignal tab.

The finished alarm: the computer links to the repeater, and the repeater links to both devices.link 1link 2link 3ComputerNetwork RepeaterEntity Detectorname: gateAlarm Modulename: siren
The finished alarm: the computer links to the repeater, and the repeater links to both devices.
  1. Place the blocks. Put down the computer. Place the repeater within 32 blocks of it, and the detector and the alarm within 32 blocks of the repeater. Put the detector where visitors will walk past, such as next to your door. Blocks with a front, like the detector’s lens, face you when you place them.

  2. Link the computer to the repeater. Hold the Linking Tool. Right-click the computer, then right-click the repeater. The message Devices linked. appears above your hotbar.

  3. Link the devices. Right-click the repeater, then the detector. Right-click the repeater again, then the alarm.

  4. Name the detector. Put the tool away so your hand is empty, and right-click the detector. A form opens. Type gate into the Device name box and select Save alias. While the form is open, check that its status says it says Connected to its computer.

  5. Name the alarm. Open the alarm’s form the same way, name it siren and select Save alias. Select Test to hear it, then Stop.

  6. Open the editor. Right-click the computer with an empty hand. The computer’s dashboard lists your devices. Select Open Editor.

  7. Load the program. Select Starters. The first starter is Intruder alarm. It is the same file as this one:

    starter-intruder-alarm.fsig
    // Starter: Intruder alarm (computer)
    // Sounds the Alarm Module "siren" when someone walks up to the Entity Detector "gate".
    // Name the two devices in their forms, link them to this computer, then start the program.
    const gate = detectors.named("gate")
    const siren = alarms.named("siren")
    // "on" runs the code between { and } every time the event happens.
    // entity tells you who arrived: entity.name, entity.hostile, entity.player and more.
    on gate.entityEnter(entity) {
    print(entity.name + " is at the gate!")
    siren.activate()
    }
  8. Save & Apply. Select Save & Apply, or press Ctrl+S. The program is checked and starts. The computer’s screen turns green to show that a program is running.

  9. Test it. Walk more than 8 blocks away from the detector, then walk back. The alarm rings and glows. In the editor, select Debug ▸ to see the program’s output, such as Steve is at the gate!

  • const gate = detectors.named("gate") gives the name gate to the detector you named gate. It is a device constant: a name for a device, not the device’s position.
  • on gate.entityEnter(entity) { ... } is an event handler. The code between { and } runs every time an entity enters the detector’s range. entity holds information about who arrived.
  • siren.activate() sounds the alarm for its configured time, 10 seconds unless you change it.

Try these one at a time. After each change, select Save & Apply.

  • Only react to monsters: put if entity.hostile { before siren.activate() and } after it.
  • Change the alarm sound: open the alarm’s form, type chime into the Sound box and select Save.
  • Make the detector smaller: set its Radius to 4 in its form and select Save radius.
  • Nothing happens and the screen is green: walk farther away and back. Check that the detector’s form says Connected to its computer.
  • The status says a name is not found: the names in the program must match the forms exactly, including upper and lower case.
  • The screen is red: the program stopped on an error. Open the editor to read it, or see troubleshooting.