Download

Infinite Loop?

Hello again guys,

I am trying to make the text of my inventoryslot button increment by 1 when an equal object is picked up. I have made a text on my inventoryslot widget (on the designer tab) and created a binding. In this binding I have this which causes and infinite loop when the first pickup is picked up, before even the second one is picked up in order to check if these 2 items which have been picked up are of the same:
1.png

What I think I have done till now is: get the array of the inventory slots, check in them if an object is the same with the other and if it is the branch brakes the loop and goes to add to the text +1, but doesn’t seem to work. An infinite loop seems to be coming from the “ObjCount” variable.

Any ideas how to approach this?
Thanks in advance

The AND node are useless?

It’s not useless, as I want to have a valid image. Anyway I tried to progress on this by making a macro with the same code on the pickup function I have and in return of the macro I get a variable which saves the objCount and transfers it to this return value you see on the picture.
The whole problem with the above picture seems to be that when I bind the text to this code, it get’s called NOT by the loop node but by the binding itself because I haven’t specified when I want this to start or end so I get an infinite loop :stuck_out_tongue:
The problem now is that every inventory slots gets the count, where instead only the slot which contains the object should. I will try to solve this but in the meanwhile if anyone has any greater idea, I’d be glad to hear it

Your equality operator is always checking the GET against itself btw.

Yes, I’ll give you an update on this tomorrow when I’ll change some things.