Keyboard Events

Hi. After pressing the button T, the variable Int is increased by 1 and the sum is displayed on the screen. After pressing the R button, the variable returns to the value 0. Explain, please, why my Blueprint works (?) although I have not connected Set to Set String for displaying 0.

Hi, your BP works because when you press “R” the value for Int is set to 0 and the String variable gets the int value. Like a get int value variable.
So pressing R will set the value of int to 0 and the String variable is getting the invormation from a get int. The green output pin from the set int is basically a get int. Like I have it in the image.

Thank you very much for the answer. But I don’t understand it at all. I thought the converter (the converter of an integer into a string) is only a converter. But thank you for taking your time to answer

Nodes are not variables itself, they only affect existing ones (listed on the left). When you press R you SET your “Int” variable to 0 so lower nodes which refer to “Int” have value 0 either, and as we can see you connected “power” to print - so it’s printing 0.
To make long story short - you did connected this variable but with lower nodes which store same value.
Right “value” pin in SET node work same as GET node I believe, and you are using get in lower section so its all same.

I meant Exec, I like to think about it this way.

277235-exec.png

Little visualization of what is happening when you press R. Orange/yellow = reason why value is 0 and blue = why is it displaying.

Thank you for the answer. What does “power” (and as we can see you connected “power” to print) mean?

Very simply put, whether you press R or you press T both pathways are connected to a “print string”. So this means that SOMETHING is going to print no matter which key you press. Now to understand what will be printed let us first start with the easy one, pressing “T”. When you press “T” the first thing that happens is a “Set” node. The “Set” node looks at what is connected to its input pin (the pin on the left) and it see it is supposed to add 2 integers, the value of the first is 1 the value of the second is connected to a reference to the variable named “Int”. So it checks the value of “Int” and adds 1 to it, and “Sets” this value which means if it were to read the variable “Int” again it would read “1” not “0”. Now that the “Set” node has done its job we move on to the “Set” string node. This node will set the variable named “String” to the value of the input pin. Since the input pin is a conversion node is converts “1” (the value of the integer named Int) to a string. So now it will print “1” but this time the data is in a string format not an integer. You wouldn’t know the difference on the screen though. This string is then printed using the “print string” node. Now when you press “R” the execution first hits a “Set” node for the variable named “Int”. This changes the value of “Int” to “0”. Previously it was “1” because we pressed “T”. Now it is “0”. Then we move t the string “Set”. Now the string “Set” node will ask itself ‘what do I set myself to?’. To figure this out it will follow the wires from the input pin (the one on the left) backwards and see it has a conversion node, it will then wonder what it is converting itself from, it will walk backwards and see a “Set” node of the variable “Int”. This set node if you hover over the little pin on the right hand side will tell you it acts like a “get” node. So this is the same as if you had a “get” of the variable “Int” like you did in the execution path of “T”. It reads the value of “Int” now 0 and prints it

Check out video #2 and 3 in this series I made, I go over variables and other blueprint fundamentals I think will help you with your understanding.

Ok. Thank you.

Thank you, but i dont understand how it works. When I press the R button - the “power” does not come from the T button via Set Integer to Set String and I do not understand why the value of the Int variable is passed to the Set String.

Get node doesn’t require “power”.
SET node without “power” work just like GET node, it doesn’t affect value, it just give it forward.
When you supply SET node with “power” you change Int variable to be exact same value as pinned (or typed) on the left side of the SET node.
So when SET node is not executed (only way to execute it is pressing T in your case) it gives default value or one which is set by upper SET node which you just executed by pressing R.
Look, both cases below work same way.

I’ve marked part used while you pressing R, as you can see part of SET node is in use too.

Thank you very much for the thorough answer. It was very difficult to understand. Thanks for taking the time to answer.

Thanks for taking the time to answer. Thanks for the links to the video tutorials.