Not serious, but I’m just curious (bars)
Why does inputting “get” and “set” at the same time through a number behavior cause an infinite loop? Does anyone know?
Not serious, but I’m just curious (bars)
Why does inputting “get” and “set” at the same time through a number behavior cause an infinite loop? Does anyone know?
Setting means using a particular number value for the behavior assigned by the programmer and getting means getting a value that already exists for the behavior so connecting both means you are trying to get an unset number value thus creating a loop where the engine is trying to get an unknown value repeatedly. This also happens in normal programming.
oh wow, didn’t know that, thanks for telling me!
You’re welcome! You can use this to your advantage as well by establishing an array for a range, and setting the value from the output to get that new value to run another behavior node of your choice creating a loop for your code! Loops are fun if maintained.
Um, no that’s just wrong, unless you are referring to something else.
This code works with no issue. The order of the inputs are important, so what happens is the number is set, then it is gotten. Visually we see this happening all at once, but in reality the behaviors and inputs are all ordered. (behaviors are read top left, to bottom right. The after that it goes to input order)
A number behavior always has a number set, it starts at 0. If you’re referring to an Expression, even an empty expression still works perfectly fine without issue, you might just get a “null” output.
The issue you are encountering @Deadly_Smile is likely not from setting and getting a Number behavior, it’s what’s happening afterwards (unless you are getting a very random bug, in which case it needs a bug report). If you send a link of the issue I can try to figure out what’s actually going wrong.
This is incorrect.
@Deadly_Smile , is a piece of your code hooked - even remotely to your Out output looping back and getting the number again? That could be a potential cause. It may also be due to the work of a Global or Always - we need to see your game to help you!!
Using “set” and “get” at the same time does not cause an infinite loop.
Oh yeah this normally occurs when I use a global or always, I just resort to using a message to get the number
I was just curious as to why this happens
Please fact check your advice before giving it to others.