How do I go through each slot and check if
Item type 4 is in array and has 10 amount AND Item type 6 is in array and has 5 amount, then just Log('Hello')?
Thank you in advance.
Array : Contains Value '4'
Set local variable to current x
If array.at(local variable, 1) = 10 then true / log hello
Array : Contains Value '6'
If array.at(local variable, 1) = 5 then true / log hello
Develop games in your browser. Powerful, performant & highly capable.
Didn't really work for me since, if I have 10 amount of anything, it doesnt matter if the x is 4 or any other number (item type), it still runs the "Hello".
Ok to run more specifically you can do :
For 0 to array.width (system loop)
Array compare at xy 'loopindex' for x, 0 for y. value = '4'
That will run through all x at y=0. This means it only checks the first row looking for a 4.
Then when its true you add the curx to local variable against array.at(localvar, 1) to get the amount for 4.
I see how it should be working and it should, but now things got even weirder since, now it prints hello in increments of five and ten, and only take into account if x:0 is occupied. The inventory I have, I've checked now multiple times, runs correctly with the values.
Did I follow your steps wrong?
Oh just as I posted the image I've seen that the item amount checking should've been a subevent. It's all good now! Thank you very much!!
Great, no problem :)