Integer += <insert>


I’m trying to make an int go up by 20, and it works with int + int, but I want a “+=” type of thing, where it counts up one by one till it gets to where it needs to be.

Any help? Thanks!

You could use a while loop node. Get the variable and drag out a pin . Connect it to the math node less than integer < set the value to 21. Then connect this as the while loop condition. Coming out of the while loop grab the integer again and add 1 to it as you were doing before.

So basically what will.happen is the loop.will run it will check the variable if it is less than 20 it will add 1 to the variable then loop back to the beggining and start the process again. When the integer reaches 20 it will stop the loop

It’s hard to tell whether or not you want it to instantly add, or slowly count up, if it’s the former: Just make your own += operator macro. Copy the stuff in the increment int macro, and just make a modification to input the number to add, make sure that your variable input is passed by reference.

Here is the macro version to increment by value X:

eXi: I don’t see that “Set Integer (by ref)” node anywhere.

EDIT: Oh I’m stupid, I just copied it from the IncrementInt macro.

Oh wait, no. I need it to count up slowly. Count up by one till it adds, for example, 20.

For example, if I have 0, and I add 20, it’ll count up “1, 2, 3, 4, 5, 6, 7” etc all the way to 20

Or if I have 30, and I add 20, it’ll count up “31, 32, 33, 34, 35, 36,” etc all the way to 50

(: No problem, i’ve never done these macros, so it was fun. Sadly they are a bit confusing to read, since “LocalInteger” can not be duplicated like a normal variable.

So there are a lot of wires, but at least we can save the final solution of this macro to compare :smiley: I tried to clean it up as good as possible.

It counts from the original value up to the “+=” value with the Incremental speed, which is the seconds between each increment.

This pastebin here could give you all the nodes BETWEEN Input and Output. Just copy the code, open a new macro and paste it:

Alright, sweet. Thanks.

However, I cannot access custom macros for some reason.

EDIT: Nevermind, I’m being stupid again!

Thanks so much.

i dont understand why you are making it so complicated . here is what i meant



or if you want it to be automatic counting use a loop as i suggested like so



if you want to tidy it up you can even put it into a custom event and call it when ever you want like so


it all depends how and when you want to use it.

the first method will only increment when you press the letter T, the loop method will automatically do it for you.

It’s not complicated. It’s just using a macro like you normally do. Also he can specify how fast it should increment.
You can’t put a delay in a for/while loop, so that’s already not working with your solution.


how is this not complicated. its messy uses twice as many nodes.

and he didnt specify that he wanted a delay.

eXi’s solution works just fine for me.

Thanks for all your suggestions.

i see what you mean now just been playing around with some stuff, macros are cool. thanks guys