Function Node

Revision as of 09:20, 28 September 2021 by Sdkuser (talk | contribs) (Node explanation)
Jump to: navigation , search

Feature Description

Function 5 1.png

This feature is meant to provide a new coding node for performing simple calculations or String operations using native JavaScript code.

In the past, simple arithmetic was not possible to do inside Intera Studio (only increment or decrement of numbers).


Now, using a simple coding lingo the user can perform a variety of handy “code snippets” with:

  • Variables: Boolean, Integer, Float and String, Arrays and Structures.
  • JSON parsing and output.

Node Editor

Function step 1.jpg


Function step 2.jpg

  • Snippet select
Select a snippet from available snippets

Snippet Symbol (Or “+” Symbol)'

Create a new or Edit selected snippet
  • TEST Button
Test selected snippet
  • Inputs
link user variables or other shared data to be input to your snippet
  • Inputs
link user variables or other shared data to be output from your snippet
  • Documentation
Inherits documentation from the snippet editor


Snippet Editor window

Function step 3.jpg


Function step 4.jpg


  • Save Button
save your snippet
  • Name
A user friendly name of your snippet
  • Define Parameters - In:
    • Add a new input parameter with the “+” sign
    • give a name to the parameter (can start only with a letter, not a number).
    • Select the parameter’s type: (String, Boolean, Integer, Float, Length, Linear Force, Torque, Speed, Time, Mass, Angle, Acceleration, Stiffness, Voltage, Percentage)
  • Define Parameters - Out
    • Add a new ouput parameter with the “+” sign
    • Give a name to the parameter (can start only with a letter, not a number).
    • Select the parameter’s type: (String, Boolean, Integer, Float, Length, Linear Force, Torque, Speed, Time, Mass, Angle, Acceleration, Stiffness, Voltage, Percentage)
  • Code Window
In this window you can add your code (between “let” and “return” commands). The window will show any syntax errors interactively with “i” and “x” icons in the problematic line.
  • Dark\Light Toggle
Switch the code window colors between dark scheme and light scheme.
  • Validate snippet
A tool to test and validate your snippet with test data you can type. A pass will result in green “V” and a fail in red “X”.
  • Documentation
Document in free text what this specific snippet does.


Example Task

  1. Create new user variables “min_var”, “max_var” and “random_var” (all should be defined as integers).
  2. Create new snippet (using Extension Gallery or Function node) with these settings
    Function step 5.jpg
    The text should be:
    function RandomMinAndMax() {
    let min, max;
    let random;
    random = Math.floor(Math.random() * (max - min + 1) ) + min;
    return {
    random, // int
    }
    }
  3. Add a Function node with these settings
    Function step 6.jpg
  4. Add a Set To node with these settings
    Function step 7.jpg
  5. Add Wait node with 1 second.
  6. The behavior tree should be like this:

Function step 8.jpg

This task is generating a new random number between 0 and max_var (which is incrementing during the task) every one second.