Edit:
Dude, i have no idea why i wrote all this, i think i reacted on an old post. Deeply sorry, to proud to just all delete it.
Tired from work i guess.
I dont recall using visible/invisible in any of the examples i gave you. I do recall using 1 sprite with all items as a frame in an animation, and a empty frame (frame zero) to represent the 'not found yet' condition, for the book. That simplified a lot of things, including the situation where you would decided to use an array.
I have no idea how you do this now, iffen you talk about setting an object visible/invisible.
The sprite.IID is an index. An index means a position in a list. All lists in construct are zero based. Wich list ? In case of the IID it is the position of a sprite in the picklist. If you made footsteps in the layout, and you made them in order, then, when you pick them all, the IDD returns that order. So IID zero is the first one you made in the layout, IDD 1 is the second one you made ... and so on. Hence, you have to create them in the right order.
Again stressing this 'picklist'. Would you pick the steps that are 'visible', then you make a total other picklist. With other (probaly less) objects in that list. So, those picked objects have another IDD.
The same objects are in another position (in the picklist) when you 'pick all' compared to 'pick visible'. See it this way. There are 10 appels on the table. When you take them all, you 10 apples picked. If you make a list of those 10 apples, then this list contains 10 apples and each apple is in a postion in the list = IDD. Now if you take only the last 5 apples. You have 5 apples picked, and the apple that was in the list on position 4 when all apples picked is now on position zero.
In short: IDD depends on wich objects are picked.
For your collectables, if they are in the new layout made in a differend order, then they have differend IID's in both layouts, when you pick them all. That is probaly your first problem.
The easy way to go with this is like .... Make a start layout with all the global objects in, on dedicated layers. Global objects !. And just go to the first game layout. The global objects will go with you. For the collectables, this the solution. All collectables must be in that 'start layout'.
But that means also that you have place each object in an event. Better is to drop the IID construction. And give each instance a instance variable with a unique number. And use that to identify it.
The book and its sprites must be global. If you use no array, the book does not need to updated when changing layout. Its just fine.
When using a global array + global objects, the book does not need to be updated when changing layout. (not to my knowledge)
About the array. Getting things out of it.
First you must understand that an array is a list. Lists go with indexes. A value sits on a certain index. The index is in the form of city,street,housenumber (x,y,z). The value can be number (3 dogs living there). Or a string ("Lukaku" living there)
Forget the z. You wil kinda never need to use it. So from now on i speak about x,y.
Now, the X axis is any position in the array (number,zero)
(7,0) lays on the X-axis. So does (12,0) and (9999,0).
As you see, the X-as is using the zero index on the Y-axis. Or, an array containing only values on the X-as (1Dimensional) must have a size of (amount of x,1,1).
This is what you have, and there is no room for additional values on the Y-position. I do not talk about the Y-axis, because using the term Y-axis has only sense in a 3D array, when (ofcourse) the Y position is using the zero position of the Z-position.
So we talk about the X-axis and about Y-postions. X-axis any position in the array where the Y-positon is zero (x,0).
X-axis and Y position.
So if you want to store values on Y-positions, the size of the array must be (amount of x, amount of y + 1). Else there is no (5,1) or (5,7) or (5,9999) available. (5,0) = de X-axis.
Why is this importand ? Because we usaly want to loop on the X-axis. We usaly want to push and pull on the X-axis.
Okay, back to index and value. To start with the expressions. There are expressions for values. And there are expressions for the index.
For the in index ....
CurX
CurY
CurZ
The current zero-based index for each dimension in a For each element loop.
For the value ....
At(X)
At(X, Y)
At(X, Y, Z)
Retrieve a value at a position in the array. Indices are zero-based. Reading values outside the array returns the number 0. If the Y or Z indices are not provided then 0 is used.
CurX has only a meaning when using a array > 'For each element' loop condition. CurY and curZ i only use when dealing wit a 3D array.
So, when you use the loop 'For each element X', this loop is running over each POSITION on the x-axis.
The expression CurX returns the position where the loop is at that moment.
So the value is at Array.At(CurX,Y-position)
But you can use any loop. If you have instances with a instance variable containing a number (dont forget first number should be zero, not 1) then you can ....
For Each Ordered (by that instance variable)
The value is now at Array.At(sprite.instancevariable,Y-positon)
You can use a regular For loop.
From "i" 0 to sprite.count - 1
value = Array.At(loopindex("i"),Y-positon)
pick nth instance .. n = (loopindex("i"))
action ... set sprite.somevariable to value
But you dont need a loop to retreive one item from the array.
The value is just at Array.At(X-position,Y-postion)
Storing in the array is just the same. Same conditions, only now we need ACTIONS.
You can use a regular For loop.
From "i" 0 to sprite.count - 1
Set at XY ... x =loopindex("i") ... y =Y-positon ... value = the value you want to store
Or a For Each Ordered (by that instance variable)
Set at XY ... x =sprite.instancevariable ... y =Y-positon ... value = value you want to store
Or just, with no loop
Set at XY ... x = X-position ... y =Y-positon ... value = value you want to store
Hope this clears some things out so you can manage what you want to. I have no idea what you are actual dooing. But i see that the size of your array is to small. And i see that you try to set the 'numbers' or the 'IDD' on the Y-Axis, and that will make it to complicated, also for me.
If you want a numberd list, trow them in the X-axis (x,zero).
Any other value goes on the Y-position. (x,y-position)