Functions and blocks are currently not integrateable. This guide will solve that.
You need:
1x function
1x counter
1x property
1x trigger
maybe extra triggers if you need more blocks
First, make the function. I will use the remainder function in this guide. Next, place a counter and make it change a property. Name the property something like NumFunctionsFinished. Place the trigger. Make the property broadcast on a channel to start the trigger’s block. After this, put these blocks in the trigger:
Add as many else ifs as you need functions. After this, you should probably make sure that the function’s output broadcasts on a channel when changed. I’ll use Remainder Obtained as the channel. After this, set this channel to increment the counter.
Optional:
To cleanly run your game, you should make it so that when the block is finished, it broadcasts on a channel that deactivates a trigger that gives access to the counter. You have to change all channels leading into the counter to lead in to the trigger and then the trigger broadcasts to the counter.
Difficulty
1
2
3
4
5
6
7
8
9
10
0voters
Please let me know there are any bugs in my system! I might not be able to respond immediately because I have 20 post limit for my first day.
No not integrals, but merging functions with blocks. This works because the property tracks how many time the trigger has called a function. Based on what that property is, it will choose which code to run.
So in block code, we would start at the x =5 line. Defining the function would take place outside the trigger. After this, we assign y=5. Then, we assign parameter1 as x and to start the function, parameter2 as y. We will now exit the trigger. When the function is finished, it will change the counter property and start the trigger we want to run. But now, it tuns the code after the function (print(“Done!”)). Another way to think of it is that the code technically does not depend on the counter property, only the other property it computes with.
The remainder function is weird, and you should just use what BlackHole927 put in the comments of it.
However, to make functions, you get some properties that the trigger uses, because it won’t understand your custom properties. When you change the last property, the trigger gets triggered and the function runs and outputs into the output variables.