Streamlining your test.con project with macros
Why use macros?
When programming with test.con, at some point most users reach a point, where the project has too many blocks to be able to see, what each section of blocks is doing. And there are probably multiple section doing the exact same thing with different inputs.
This is a small example of the size difference between a simple arithmetic and comparison build from the basic blocks:
and a macro from these blocks:
The macro has the same amount of inputs and outputs, but uses much less space and can be used multiple times, without the user having to rebuild or copy all the blocks again.
How can you create a macro?
Right click onto a folder in your project tree and choose "New Macro Block"
Right click your new macro and choose "Rename"
This is not strictly necessary, but it helps keeping the project in a "readable" state.
Now you have a new Tab with the name of your macro.
If the tab does not appear, just right click the macro and choose "Edit"
The programming surface handles exactly the same as the surface of your main program. You can now copy and paste the blocks you want to move into the macro from your main program or any other macro into the new macro.
e.g.:
Now you need the input and output blocks for this macro, which you can find in the "Standard" Library:
Connect all Inputs and outputs with these blocks. The Blocks can be named, which is highly recommended for ease of use of the resulting macro.
Designing the macro block
The visuals of the resulting macro can be edited with the design editor.
Right click on the macro and choose "Design"
The connectors and box size can be moved freely to adjust the size.