(solved) Loop a global array

Hey team.
Looking to make a ‘for loop’ for a global variable array. Currently I cannot figure out how to call a global variable for a ‘for every’ event loop.
Any workaround/solution would be much appreciated. My current thought is to load that global array into a scene array so it can be called by the loop (since it seems scene arrays can be called), but that seems silly and very wasteful.

Essentially making a game with an inventory stored in a global array (since the inhouse inventory isnt particularly well documented and seems a bit primitive for what I need).
I want to run a for loop when adding items to the inventory to check if that inventory slot is already taken up by another item within the inventory (by checking a boolean child in the array).

Any thoughts or comments welcome :slight_smile:

Using InventoryArray as the global array variable and a scene variable _arrayCounter as the loop counter, set to 0.

Create an empty while event, and set the condition to Variable(_arrayCounter) < GlobalVariableChildCount(InventoryArray).

You can then add actions, and reference the array slot with InventoryArray[Variable(_arrayCounter)].

Remember to increment _arrayCounter (otherwise it’ll be looping infinitely…)

Bloody genius, thanks!!