The ultimate goal: each time the loop is run, it checks if the player has any items that are defined in the Imports array (each value in the array has been set to an item reference, which is why the arrays are defined as properties). If he does, they are replaced with the equivalent item defined in the Base array.
Ingredient[] Property Imports autoIngredient[] Property Base autoInt property ItemCountInt autoFunction ReplaceObject(Ingredient[] Imports, Ingredient[] Base) int CurrentElement = 0While (currentElement < Imports.Length) if Imports.length == base.length Int ReplaceElement = base.Length ItemCountInt = (game.getPlayer().getItemCount(currentElement)) game.getPlayer().RemoveItem (currentElement, true) game.getPlayer().addItem (ReplaceElement, true) currentElement += 1 endIf endWhile endFunction

