-
Notifications
You must be signed in to change notification settings - Fork 0
3. Visual Scripting Editor
Visual scripting is a highly understandable system, and all you need is a touch of creativity. If you are familiar with nodes, the node-connection system in Scratch, or blueprints in Unreal Engine, visual scripting in Poly Engine will be easy for you.
Like all other visual scripting editors, you can create variables, conditions, operations, statements, functions, and methods in Poly Engine (PE). PE contains many new additions that can be beneficial in various cases, such as Variable Connectors, Flexible Statements, and Flexible Extended Statements (described in Programming Language category). You don't need to know the Poly Engine's main language syntax if you prefer to work solely in the visual form.
- Variable declaration & drag-drop elements
- Compiling order & functions
- Hello World
- Scripts & extensions
- Execution order
- Flexible Statements
- Compile
To declare a variable or create any element in visual scripting editor, use the upper panel and select the appropriate category. Let's choose 'variables' and create an Integer. You can move the cursor and place the element wherever you wish. Press the left mouse button to drop it. To drag, press the left mouse button again.

The compiling order is a system that instructs the engine on what should be compiled first and what should be compiled last. All variables have the same compiling order (you can see the order number in the right corner when you create any other element). To change the compiling order, click on the bottom-gray line of the element and drag it to the specific element to switch the compiling order. By clicking on the bottom-gray line, you can also change the element's executable function (the default is 'Start'). You can create your own function by clicking Add in the Functions section in the upper panel.

On the right side of the visual editor, you can find the Output Console, which logs the current state of the engine. You can use the Output Console to log your own information, which can be found in Statements/Console Output. To mention any declared variable in Console Output, use the @ and ; characters. For example: 'Hello World. My Age is @age; and that's not too much!' This format helps the program recognize declared variables and regular text.

Poly Script allows you to extend your scripts and make them clearer. To add a new script to your project, use the right plus button, enter the script name, and press Enter. To delete a script, use the left minus button. Please note that the Default script cannot be deleted.

The execution order instructs the engine on which script should compile first and which script should compile last. You can find the Execution Order in the upper panel under Window/Execution Order. Here, you can select which scripts will be added to the execution order and specify the desired order. To change the script execution order, simply drag the selected script name in the right panel and drop it onto the script you want to switch with. The order in the right panel starts from top to bottom.

Flexible Statements allow you to use Poly-Engine built-in functions and returnable special methods. To access the flexible statements option menu, double-click on the text field of your element. The property window will show up, and you can choose one of the flexible statements. You can choose between Extended Statements and Flexible Statements. For more information, refer to Source Programming.

If you would like to execute your work, click the Compile button. The console will log the engine status, and you are done. If you want to see the original source code or prefer coding in Source Code without visual support, simply press Change Editor Mode. If you are working in source code and want to convert your source to the visual form, set your editor mode to Visual Editor and click Convert To Visual. The same thing, but in the opposite direction, happens when you click the Convert To Source button.
