When re-initialising screen, amount of list entries reduces

This is for a children's game. The app (when Screen1 is initialized) picks randomly a list of letters (letters that children who learn to read often mix-up), e.g. d, b, p, q. Out of 35 buttons, one of the letters, e.g. "d", is written on random 7 buttons. The empty 28 ones are randomly filled with the remaining letters of the list. Then the child is supposed to find the 7 letters with "d" on them.

It worked perfectly as long as I used the programme-internal "Screen1.Initialize" procedure and all the blocks I put in there. Because I wanted to re-initialize the screen during the app running, to create a new game when all letters were found, I copied the whole "Screen1.Initialize" procedure and put it in a new Procedure, that I call when one game is finished. Additionally, I reset all variables I have and re-empty all the lists I use as copies of the letter lists.

The problem is, although the copied lists are re-filled every time newly, their content reduces by 1 one each time the re-initialize procedure is used. I just can't get my head around, why!

Your blocks image doesn't help to reveal the issue. I would suggest you look through your procedure and debug to find out where you need to reset values. This reset is obviously happening on Screen initialise but is not happening when you run the procedure.

Is this related to your previous topic Appears to go through loop less often than intended - #4 by MarcBert

This procedure contains precisely the same as the programme-internal "Screen1.Initialize" procedure. I just added some blocks for resetting the variables and re-emptying the copy lists.

This is the same app, but a different problem. This former issue is solved.

I don't see where you use the AI2 COPY LIST block.
All you did was set another variable to point to the same original list in memory.
Naming the other variable CopyList does not make it point to a new list.

1 Like