Can somebody explain these two nodes to me, merge and sequence ? I don't know what they are, how to connect them and even what they do


#1


I know absolutely NOTHING about these two nodes.
Can some explain it to me ?
Thanks.


#2

Merge allows you to have several inputs all making the same sequence run. For example pressing w, pressing the up arrow and pressing up on a game pad all do the same thing in the game.

I believe sequence is a longer version of alternate. so the first time through does output one, second output 2, third, output 3 and forth, output 1 again.


#3

I don’t think sequence is longer version of alternate. I think that sequence node execute code in sequential order.
Ue4 has this sequence node and i think both might have same function(Sequence in ue4 and armory).
Means you can connect many node in OnInit or OnUpdate out socket.


#4


The merge docu is completed thanks to @Monte_Drebenstedt.

Now time to investigated on this…sequence node…


#5

Do you know the “Alternate” node? It is basically the same thing, but not cycling between only these two but all the outputs you created for it. It runs down them and starts back at the top.


#6

Imagin this setup:

and this setup:
image

In the first case it will print 0 1 2 3 4. Always.
In the second case… you cannot really tell in which order the print statements will be executed. I arranged them to look like it would print 0 1 2 3 4, but actually it prints 0 2 4 1 3. Why? because I first connected 0, then 2, then 4 and so on.

tl;dr:
Sequence guarantees you that the “code” will be run in this order (just like connecting the output of one of the print nodes to input of the next one).
Without Sequence it depends on which you connected first (which you cannot see afterwards).


#7

Actually it looks like the alternate node is running a different output each time it is activated, but it will only run one of the outputs.
The sequence node runs all of its outputs when activated. But it guarantees you that they will be run one after another in that specific order.


#8

Oh yes you are right, thought it worked differently. Sorry about that!


#9

I will have to correct that in my video series. Thanks guys for clearing this up.


#10

Does sequence wait for each output to complete before executing the next function ?
Say each function have a recursive loop going on would it wait for the loop to be finish before executing the next sequence which also have other loops ?


#11

As far as I can see, yes it waits.

This setup contains two endless loops, one of which prints 0, the other one prints 1.

After hitting “a”, my game obviously freezes and it prints out a ton of 0’s to the console. But there is not a single 1. So the second output is never run, because the first one does not finish.

This also makes total sense, as the node is called sequential. If it would not wait, it would probably be executing everything at the same time and should be called parallel.


#12

Sorry it doesn’t work at all for me.


#13

That is strange. Try removing that yellow reroute, it seems to be causing issues.
I just tested it and it works fine here… until I add that reroute. When I added that, it infinitely repeated the Loop until it was out of stack space and then crashed. Which is probably what you are experiencing as well.
Just another thing, if you change that on mouse node from down to started, it only runs once every time you click and does not flood your console, making debugging a little easier.