Nodes
Switch on Int#
The Switch on Int node allows you to route the flow of your spell based on the value of an integer input. It's useful when you need to execute different actions or paths depending on a specific integer condition.
Inputs#
flow(required): The input flow that will be routed based on the integer selection.selection(required): The integer value that determines which output the flow will be routed to. Default value is 0.
Outputs#
default: The default output flow if theselectioninput does not match any of the configured cases.- Additional outputs will be dynamically generated based on the 
numCasesconfiguration. 
Configuration#
numCases: The number of cases (integer values) the switch should handle. This determines the number of additional outputs the node will have.
Usage#
- Connect the input flow to the 
flowinput of the Switch on Int node. - Connect the integer value you want to switch on to the 
selectioninput. - Configure the 
numCasesoption to specify how many different integer cases you want to handle. - The node will generate additional outputs labeled 
case0,case1, etc., based on thenumCasesvalue. - Connect the appropriate output to the next node in your spell for each case you want to handle.
 - If the 
selectioninput doesn't match any of the configured cases, the flow will be routed to thedefaultoutput. 
Example#
Let's say you have a spell that needs to perform different actions based on a user's age. You could use the Switch on Int node to route the flow like this:
- Connect the user's age (as an integer) to the 
selectioninput. - Set the 
numCasesconfiguration to 3 to handle three age ranges: child (0-12), teenager (13-19), and adult (20+). - The node will generate four outputs: 
default,case0,case1, andcase2. - Connect the 
case0output to the nodes that handle the logic for children. - Connect the 
case1output to the nodes that handle the logic for teenagers. - Connect the 
case2output to the nodes that handle the logic for adults. - Connect the 
defaultoutput to handle any age values that don't fall into the specified ranges. 
Best Practices#
- Make sure the 
selectioninput is connected to an integer value. If it's not an integer, the flow will always be routed to thedefaultoutput. - Configure the 
numCasesoption to cover all the cases you need to handle. If you need to add more cases later, you'll need to reconfigure the node and reconnect the outputs. 
Common Issues#
- If the 
selectioninput is not connected or receives a non-integer value, the flow will always be routed to thedefaultoutput. - If you change the 
numCasesconfiguration after connecting the outputs, you'll need to reconnect them to ensure the flow is routed correctly.