Skip to content

Nodes

In Visual Scripting, nodes are fundamental building blocks that represent specific operations or actions in a Script. Here are some examples of actions that a node can do:

  • Some nodes take in some inputs, processes them, then outputs some values (check out Operator Node)
  • Some nodes simply redirect the Flow of the Script depending on a condition (check out Branch Node)
  • Some nodes do some system actions (check out Log Node)

Nodes come in different sizes and shapes, are made up of different kinds of Ports, and can be linked to other nodes through Links, but they are all essential parts of a Script in order for that Script to do something.

Creating Nodes

To create a node, simply right-click on the Script View. This will open up the Node Context Menu, where you can search for and choose the node you'd like to add. When hovered, each node in the menu will also show a short description about what they do. Once you found the node you'd like to add, simply click on the menu option, and the node should be added on the Script View near where you right-clicked.

Creating nodes through the context menu

Another way of creating nodes is by dragging a port of another node and dropping on an empty space of the Script View. This will also bring up the Node Context Menu, but filtered so only the nodes that can connect to the dragged port will be shown. For example, if you drag on a Number Value output port, the context menu will be filtered so only the nodes with Number Value input ports will be shown. The same goes when dragging flow ports; only those with flow ports will also be shown.

Creating nodes by dragging links from ports

Node Colors

While some nodes have a gray color scheme, there are other nodes that are colored differently, depending on what those nodes do. Here are the various categories of nodes differentiated through color.

Logical Nodes (indigo)

Nodes that fall in this category redirect the Flow of the Script depending on whether a condition is met. That condition can be:

  • checking if a value is true or false
  • checking whether a value equals another value

Depending on the condition, the Flow is redirected to only one of the connected nodes. You can think of this as a railroad switch redirecting a train to only one of the tracks.

There are only three nodes that fall in this category:

Examples of Logical Nodes

Operator Nodes (teal)

Nodes that fall in this category takes in some inputs, operates on those inputs, then outputs some values. These nodes usually only deal with values, and do not affect the Flow of the Script. Some examples of these nodes are:

Examples of Operator Nodes

Event Nodes (light green)

Nodes that fall in this category activate when some outside event happens. Some may have changeable conditions, which changes when the node is activated, on the node itself. These nodes stop the Flow of the Script and only continues it when the node is activated. Some examples of these nodes are:

Tip: Another way to be able to tell these nodes apart from others is that their names begin with either an On or Wait. To learn more about Event Nodes, please check out the [[All Nodes#Event Nodes|All Nodes - Event Nodes]] section.

Note: All nodes within this category have a particular quirk: these nodes only activate once when an outside event happens. If you want these nodes to continue activating every time the outside event happens, the Flow of the Script has to loop back to these nodes.

Examples of Event Nodes

Profile Nodes (deep purple)

Nodes that fall in this category are related to the User Profile and our other LiveOps features. Some nodes directly retrieve a value from the User Profile, while others utilize LiveOps features, such as Segmentation and Offers, to change the Flow of the Script depending on which segment group the end user is in, or whether an offer was purchased. Some examples of these nodes are:

Note: The Activate Offer Node is currently colored gray instead of deep purple so the sprite can be seen clearer, but it can still be categorized as a Profile Node.

Examples of Profile Nodes

Variable Nodes (blue)

Nodes that fall in this category are related to the Variables within a Script, but also includes Document-specific nodes. The Variable-specific nodes allow getting values from and setting values to variables. Similarly, the Document-specific nodes allow getting a document, finding a document, or creating a document. There are only five nodes that fall in this category:

Examples of Variable Nodes

Danger Nodes (red)

Nodes that fall in this category require special care when activating, as it may lead to unexpected loss of progress or data if activated unintentionally. Make sure that you know what the node does exactly before adding it to your Script. There are only two nodes that fall in this category:

Examples of Danger Nodes

Flow: The Basics

An algorithm is a series of instructions given to a computer, and the computer will execute these instructions, step-by-step. Unlike with a recipe, where the cook has some creative freedom when following it, the computer follows the instructions given to it precisely, while making no assumptions about whether the instruction is right or wrong. Therefore, it is up to the programmer to give precise instructions for the computer to follow.

Visual Scripting makes creating those instructions easier and much more intuitive. All the precise instructions needed to do something are hidden away within nodes, leaving you with only the important and higher level instructions to work with. However, it is still important to know how and when each instruction will run, when a Script is executed.

There are two levels of Flow to keep in mind when thinking about and planning your Scripts: the Control Flow level, which is more concerned with the order of execution between nodes, and the Value Flow level, which includes both nodes and its Value Ports, and how they all work together to bring about the overall behaviour you require from your Script.

Control Flow: Nodes and Flow Ports

The Control Flow primarily deals with the arrangement and connections between nodes. These nodes are connected to form a flowchart-like structure, illustrating the sequence of actions that the Script will take. When planning out your Scripts, especially those with complex behaviours, it may be best to first lay out the steps in a flowchart, making sure to break down any steps that are too complex to be in one node.

The Control Flow is facilitated through Flow Ports. Connecting nodes to each other through their Flow Ports is similar to creating connections between shapes in a flowchart, and depending on which Flow Ports are connected to each other, it can be determined which node will execute next.

Most nodes have a simple interaction with the Control Flow; after a node finishes its execution, the next connected node executes in order. However, there are certain nodes that have some "control" over the order of execution in a Script. Here are some of those nodes:

  • Branch Node - Depending on the value assigned to this node, either the node connected to the True port or the node connected to the False port runs.

  • Parallel Node - When this node executes, all nodes connected to it executes in parallel.

  • For Each Node - Executes the node connected to the Body port for each of the items in the given List.

Updating Scripts

Attention!

This section contains important information, please read it carefully.

Scripts remember their current state between sessions, so after user returns back they will continue to execute from the last active node. Updating the script may break the Flow, if the active node will be changed. Script's behaviour may become unpredictable.

We strongly recommend not to modify existing scripts after they were deployed to end users. Instead of modifying the existing scripts we recommend creating copy of the script and make all the required changes in the new script. Then assign new script to the places where the old one was used. So the new users will get the new version. After that, give the users of old script some time to finish execution of their script and delete the old unused script in upcoming update.

In some cases you might need to clean up things before removing an old script. For example, if the script was used to activate offer, you might want to deactivate it. To do so, add the node 'On Script Will Exit' to the old script and perform any necessary actions after it triggers. Such an update could be done to the old script without leading to any issues with the Flow.