Skip to main content

Worked recipes

These recipes describe block connections. Build them in the editor; the indented examples are not importable code. Start before a runtime session exists and confirm draft mock mode in Results. For an importable example, use the player and bot dice workspace.

A button that counts presses​

Create an Integer presses starting at 0:

on GUI button, title "Count", role wearer
set presses to presses + 1
print text in UI: create text with "Presses: " and presses

Press twice and expect 1, then 2. Reset the draft test state and expect the next run to show 1. Saving a live program is not a counter reset.

Uses Events, Variables, Values, Text, and UI.

A reminder that can be canceled​

on GUI button "Schedule reminder"
schedule custom event Reminder after duration 30 minutes

on GUI button "Cancel reminder"
visible: custom event Reminder is scheduled?
cancel custom event Reminder

when custom event 1 named Reminder fires
send notification to wearer
title: "Reminder"
message: "Your reminder is due."

Check that scheduling twice leaves one pending occurrence, and canceling removes it. In the draft tester, run the custom-event entry point to inspect its message; that checks the handler, not the passage of real time.

Uses Custom Events and Logs.

Completion-only follow-up for one task​

Create Text variable trackedRun, initially empty. Choose a task already configured on this lock. For this simple recipe, track one outstanding matching assignment at a time:

  1. A GUI button runs assign existing task.
  2. when task assigned filters for that task ID and stores its task run id in trackedRun.
  3. when task completed checks that trackedRun is nonempty and equals the event's task run ID, then prints "Tracked task complete" and clears trackedRun.
  4. A matching when task failed clears trackedRun without the success message.

Test completion with a matching ID, a different ID, and an empty tracked value. Only the matching completion should print the success message. Do not assign a second matching task before the first finishes: this single variable tracks only the latest assignment. For a live reward, replace the printed message only after checking the task's own rewards so you do not unintentionally award both.

Uses Lock Actions, Events, Lock Data, and Logic.

A weekday calendar entry​

  1. Add every selected weekday, select Monday–Friday, and enter 08:00, wearer local.
  2. Connect create calendar entry as wearer.
  3. Set the title to "Daily check-in", start to timestamp for today + 0 days at hour 9 minute 0, whole day to false, duration to 15 minutes, and reminder to true.
  4. Print the formatted start timestamp during draft testing to check the chosen date and timezone.

This creates a new entry on each execution. Avoid also running the same creation stack manually on that day unless you want an additional entry. Automatic schedules are server-processed and may run late after downtime.

Uses Events, Calendar, and Time & Date.

Check a program before using it live​

Compile, inspect warnings, and try each branch in the draft mock. Check zero/missing event values, canceled input, repeated button presses, and the state left by a previous run. Then review testing modes and permissions before attaching it to an active lock. A live test performs real actions and a failed run may have completed earlier steps.