Trigger
The Trigger node is a fundamental component in Magick that allows you to initiate a spell based on a custom event. It acts as the starting point for your spell, waiting for a specific event to occur before triggering the execution of the connected nodes.Inputs
flow: The input flow port that allows the Trigger node to be connected to other nodes in the spell.
Outputs
flow: The output flow port that is activated when the specified custom event is triggered, allowing the execution to continue to the next connected node.
Configuration
customEventId(string, default: “-1”): The unique identifier of the custom event that the Trigger node should listen for. This ID should match the event you want to trigger the spell.
Usage
- Drag and drop the Trigger node onto the canvas.
- Connect the
flowoutput port of the Trigger node to the input port of the next node in your spell. - In the configuration panel of the Trigger node, set the
customEventIdto the ID of the custom event you want to listen for. - Deploy your spell.
- When the specified custom event is triggered, the Trigger node will activate, and the execution will continue to the next connected node in the spell.
Example
Let’s say you have a spell that sends a notification when a specific custom event is triggered. Here’s how you can use the Trigger node to start the spell:- Create a new spell and add a Trigger node to the canvas.
- Connect the
flowoutput of the Trigger node to the input of a Notification node. - Configure the Trigger node by setting the
customEventIdto the ID of the custom event you want to listen for (e.g., “myCustomEvent”). - Configure the Notification node with the desired notification settings.
- Deploy the spell.
Best Practices
- Choose a unique and descriptive
customEventIdto avoid conflicts with other custom events in your system. - Keep your spells focused and modular by using separate Trigger nodes for different custom events, rather than trying to handle multiple events in a single spell.
Common Issues
- Make sure the
customEventIdin the Trigger node configuration matches exactly with the ID of the custom event you want to listen for. Any mismatch will prevent the spell from triggering. - If your spell is not triggering as expected, double-check that the custom event is being properly triggered in your system and that the event ID is correct.
