Hi, I got stuck with this. I want to increment a float or an integer if condition is true. My current setup is not working, it always gives me 12.
Hi, I’m assuming that A1 & A2 are the values that you want to increment. The reason you’re getting the final value as 12 for the true condition is because A1 is always set to 9.0 while A2 always gets assigned a value of 3.0. In order to increment these values, you’ll have to add the amount to be incremented to the existing value before setting it.
For example, in the first case, you Get A1, pass it through an Add node with the its second input pin set to 9.0, and connect the output to the Set A1 node. You can then A2 in a similar manner, but with the Add node taking in a 3.0 as the second input.
@Stormrage256 Thanks, I see what the problem is but I didn’t quite understand the solution. This is my very unsuccessful attempt.
I got it working, but still don’t understand the “add” way of doing it.
I meant something like this:
Its using the same add node that you’re using before the Truncate operation. So when you want to increment a certain variable by say 9.0, you can just pass the original value (A1) and the value to be added (9.0) and the final result can be stored back as the new value of A1.
I see, I tried that but it didn’t’ work either. Indeed that to me looks the same that just setting the values. Anyway, the thing was just getting the values from a different string to do the maths. Thanks for your support!