Skip to content
SoulFire LogoSoulFire

Examples

Larger visual script patterns with the exact ports to connect.

Each example lists its nodes and the wires to connect. Build the first script before you use this page.

How to read the steps

Port names use the labels that the editor shows, such as Out, In, True, and Loop. The node reference lists the matching port IDs.

An execution wire runs the next node. A data wire supplies a value. A bot trigger puts its bot in the execution context, so a bot action needs no separate bot wire. Connect a Bot input only to override that bot, or after a trigger that supplies no bot.

These steps use the current node names. Releases up to 2.10.7 show On Join for On player ready, Print for Log message, Pathfind To for Go to position, and Debounce for Cooldown. The node types are unchanged. See names and compatibility.

1. Greet on join

Goal: send one message when a bot is ready in the world.

  1. Add On player ready and Send Chat.
  2. Connect On player ready: Out to Send Chat: In.
  3. Set Send Chat: Message, for example hello from SoulFire.

The trigger supplies the bot. This is the graph from the first-script tutorial.

2. Simple chat command

Goal: reply with pong when chat contains !ping.

  1. Add On Chat, String Contains, Branch, and Send Chat.
  2. Connect On Chat: Message (Plain Text) to String Contains: Text.
  3. Set String Contains: Search to !ping.
  4. Connect String Contains: Result to Branch: Condition.
  5. Connect On Chat: Out to Branch: In.
  6. Connect Branch: True to Send Chat: In.
  7. Set Send Chat: Message to pong.

The bot also receives its own pong. That message does not contain !ping, so the graph does not loop. For more commands, use a Switch node in place of several branches.

3. Poll all bots on a timer

Goal: log the health of every connected bot every five seconds.

On Interval supplies no bot, so this graph gets the bot list first.

  1. Add On Interval and set Interval (ms) to 5000.
  2. Add Get Bots, For Each Bot, Get Health, and Log message.
  3. Connect On Interval: Out to Get Bots: In.
  4. Connect Get Bots: Out to For Each Bot: In.
  5. Connect Get Bots: Bots to For Each Bot: Bots.
  6. Connect For Each Bot: Loop to Get Health: In.
  7. Connect For Each Bot: Bot to Get Health: Bot.
  8. Connect Get Health: Out to Log message: In.
  9. Connect Get Health: Health to Log message: Message.

Use this pattern for periodic work across a whole project.

4. Respawn and notify Discord

Goal: respawn after death and send a webhook message.

  1. Add On Death, Respawn, and Discord Webhook.
  2. Connect On Death: Out to Respawn: In.
  3. Connect Respawn: Out to Discord Webhook: In.
  4. Set Discord Webhook: Webhook URL and Content.

For a message with event values, add Format and connect its Result to Content. If the server already respawns players, remove Respawn and connect On Death: Out to Discord Webhook: In. Treat the webhook URL as a secret. A script export contains it.

5. Flee when hurt

Goal: move away from the current position when a bot takes damage.

  1. Add On Damage, Get Position, and Pathfind Away From.
  2. Connect On Damage: Out to Get Position: In.
  3. Connect Get Position: Out to Pathfind Away From: In.
  4. Connect Get Position: Position to Pathfind Away From: Position.
  5. Set Pathfind Away From: Distance. The default is 10.

To flee only at low health, add Branch after the trigger and compare On Damage: New Health with a limit. Connect Pathfind Away From: Error to Log message to see failed routes.

6. Mine a nearby block

Goal: find a block, walk to it, and break it.

  1. Add On player ready, Find Block, Branch, Go to position, and Break Block.
  2. Connect On player ready: Out to Find Block: In.
  3. Set Find Block: Block Type and Max Distance. The defaults are minecraft:diamond_ore and 16.
  4. Connect Find Block: Out to Branch: In.
  5. Connect Find Block: Found to Branch: Condition.
  6. Connect Branch: True to Go to position: In.
  7. Connect Find Block: Position to Go to position: Destination and to Break Block: Position.
  8. Connect Go to position: Out to Break Block: In.

Use a disposable world for this test. To repeat the search, add Wait before you loop. Do not put a mining loop on a tick trigger.

7. Small AI responder

Goal: send a chat message to a model and post the answer in the game.

  1. Build the On Chat, String Contains, and Branch part of example 2. Set Search to a keyword such as !ai.
  2. Add LLM Chat, Send Chat, and Log message.
  3. Connect Branch: True to LLM Chat: In.
  4. Connect On Chat: Message (Plain Text) to LLM Chat: Prompt.
  5. Set a short LLM Chat: System Prompt and a Model.
  6. Connect LLM Chat: Success to Send Chat: In, and LLM Chat: Response to Send Chat: Message.
  7. Connect LLM Chat: Error to Log message: In, and LLM Chat: Error Message to Log message: Message.

LLM Chat uses the provider from the project's AI settings. If Model is empty, the node requests gpt-4o-mini. Set the model explicitly for another provider.

Every matching chat message causes one provider request. Add Rate Limit or Cooldown before LLM Chat.

Debugging advice

  • Add Log message while you build a script.
  • Keep the first version linear. Add loops and branches after the simple path works.
  • Use On player ready or On Interval while you prototype. Tick triggers are harder to follow.
  • Add Wait, Cooldown, or Rate Limit before a repeated web or AI call.
  • Read script debugging for validation, logs, and quotas.

Last updated on

Was this page helpful?