Flows
Flows allow you to create reusable subflows within a single script file. Use them to organize complex logic, avoid duplicating node patterns, and keep your canvas clean.
Overview
Flows are a powerful organization feature introduced in StoryFlow Editor v1.3.0. They let you define named entry points within a script that can be called from anywhere in the same file using Run Flow nodes.
Why Use Flows?
- Reusability: Define a sequence of nodes once, call it from multiple places
- Organization: Break complex scripts into logical, named sections
- Maintainability: Update flow logic in one place, changes apply everywhere it's used
- Cleaner Canvas: Reduce visual clutter by grouping related nodes into flows
Flows vs Run Script
Flows are subflows within the same script file. They're for organizing logic within a single file.
Run Script nodes call different .sfe files. They're for splitting your project across multiple files.
Flows Panel
The Flows panel is located in the left sidebar, below the Variables panel. It shows all flows defined in the current script file.
Panel Features:
- Collapsible: Click the header to expand/collapse the panel
- Flow List: Shows all flows with their names
- Search: Filter flows by typing in the search bar
- Add Button (+): Create a new flow with a single click
- Flow Count: Header shows total number of flows
- Click to Jump: Click a flow name to center the canvas on its Entry Flow node
Context Menu (Right-Click):
- Rename: Change the flow's name
- Delete: Remove the flow (deletes the Entry Flow node)
- Show in Canvas: Center view on the Entry Flow node
Creating Flows
There are several ways to create a new flow:
Method 1: Flows Panel
- Click the + button in the Flows panel header
- A new flow is created with a default name (e.g., "NewFlow0")
- An Entry Flow node is automatically added to the canvas
- Click the flow name to rename it
Method 2: Node Creation Menu
- Right-click on the canvas to open the node creation menu
- Navigate to Flow Control → Entry Flow
- Select an existing flow or create a new one
Method 3: Copy/Paste
When you paste Entry Flow or Run Flow nodes that reference flows not in the current file, the flows are automatically created. This makes it easy to share flow patterns between scripts.
Naming Flows
Use descriptive names that indicate what the flow does: "CheckPlayerInventory", "ShowShopMenu", "HandleCombatResult". Good names make your flows self-documenting and easier to find in the panel.
Entry Flow Node
The Entry Flow node marks the starting point of a flow. When a Run Flow node calls this flow, execution begins at the Entry Flow node and continues through connected nodes.
Node Properties:
- Flow Name: Displayed in the node header, matches the flow name in the panel
- Visual Style: Green glow, similar to the Start node
- One Per Flow: Each flow has exactly one Entry Flow node
Handles:
- Output (Right): Single execution output - connect to the first node in your flow
Behavior:
- Entry Flow nodes are never executed automatically - they only run when called via Run Flow
- They act like sub-entry-points within your script
- Execution continues until reaching an End node or a node with no output connection
Entry Flow vs Start Node
The Start node is the main entry point for your script - it runs when the script loads. Entry Flow nodes are secondary entry points that only run when explicitly called with Run Flow.
Run Flow Node
The Run Flow node calls a flow and transfers execution to its Entry Flow node. It's how you invoke the reusable logic you've defined in flows.
Node Properties:
- Flow Selector: Dropdown to choose which flow to call
- Searchable: Type to filter flows by name
- Visual Style: Green glow, matching Entry Flow and Run Script nodes
Handles:
- Input (Left): Execution flow - when reached, calls the selected flow
- Output (Right): Execution continues here after the flow completes
Execution Flow:
- Execution reaches the Run Flow node
- Runtime jumps to the Entry Flow node of the selected flow
- Flow logic executes until completion
- Execution returns and continues from Run Flow's output
Tip: Quick Navigation
Right-click a Run Flow node and select "Go to Entry Flow" to quickly jump to the flow's Entry Flow node on the canvas.
Best Practices
Follow these guidelines to get the most out of flows:
When to Use Flows
- Repeated Patterns: If you find yourself creating the same node sequence multiple times, make it a flow
- Complex Logic: Break down complicated decision trees into smaller, named flows
- Shared Behavior: Logic that multiple dialogue paths need to execute
- Utility Functions: Common operations like inventory checks, stat updates, or UI displays
When to Use Run Script Instead
- Different Scenes: Separate script files for different locations or chapters
- Large Projects: When a single file becomes too large to manage
- Reusability Across Files: Logic that needs to be called from multiple script files
Organization Tips
- Position Entry Flows: Group Entry Flow nodes in a dedicated area of your canvas (e.g., bottom or side)
- Add Comments: Use Comment nodes near Entry Flows to document what each flow does
- Consistent Naming: Use a naming convention like "Flow_CheckInventory" or "check_inventory"
- Keep Flows Focused: Each flow should do one thing well - avoid making flows too complex
Circular Calls
Avoid creating circular flow calls where Flow A calls Flow B, and Flow B calls Flow A. While the runtime handles this gracefully, circular patterns can make logic difficult to follow and debug.
Example Use Cases
Inventory Check Flow:
Create a flow called "CheckHasKey" that checks if the player has a key item and branches accordingly. Call it from any dialogue where you need this check.
Shop Menu Flow:
A flow called "DisplayShopMenu" that shows available items and handles purchases. Call it from different merchant NPCs without duplicating nodes.
Combat Result Flow:
A flow called "HandleCombatEnd" that processes victory/defeat, updates stats, and transitions to the next scene. Reuse across all combat encounters.
Next Steps
Now that you understand Flows, explore Variables to learn about storing state, or check out Node Types for a complete reference of all available nodes.