Accessing clone variables

... which isn't what SCRIPT VARIABLES does.

Make a for-this-sprite-only variable in the parent sprite, and all the children will inherit it. (Actually if you make the variable in the parent before making the clones, it will be copied rather than inherited, which is what you want. If you make the variable after making the clones, there will just be one copy shared among all of them, but if you assign a new value to that variable in the clone, it gets its own copy split off from the parent, so that works for you too.)

That's what I'm doing in my second post. Sorry if it wasn't very clear.

Oops, sorry, I was answering your first post in parallel with you writing the second one.

From what you report, my guess would be that the clones are in layer order. Clicking on a sprite moves it to the front layer. Experiment and see if I'm right. :~)

You are right, but it seems to be backward from what you would expect. Telling a clone to go to the back layer actually moves it to the front of the list of clones.

The last to move is the first in the list of clone because it's on top...

I think

You can number the clones using a variable:

What a brilliantly simple solution :slight_smile:

The clones, by default, are numbered in their parent's clone list, so you don't even have to access variables for that:

Nice but @loucheman method is VERY simple - I like simple :slight_smile:

But, if you read the entire thread, the whole problem is that the clone list gets reordered sometimes, so you can't rely on it for a stable ID!

Create a sprite-local variable for the ID. You can increment it before/after each create a clone block, or tell my parent to increment it at the top of the when I start as a clone script.

This does it:

Am I the only one around here who reads the entire thread before replying? :~/

No, I do, too. (I try to make sure nobody else says something before I say it, but sometimes I miss something.)

I do (which is why I haven't said anything before)

@snapenilk @ego-lay_atman-bay Okay, sorry, I was feeling exasperated probably for reasons unrelated to the forum. (Such as the fact that in Alameda County they're still just doing age 75+ even though California is allowing 65+.) (Among other issues...)

It is what Joan said two, no, it's already three months ago, at GitHub - see the link below.


Ah, would you mind if Joan's solutions were put in the FAQ category, copy pasted? Oh, and inserted into the next version of your official Manual, @bh ? Please.

It's the vaccination plans that you are talking about, aren't you?

I can empathize with you.

I can hardly wait to get it myself after my wife (who works in a hospital) has been vaccinated with the second dose of the Pfizer/BioNTech vaccine, already, with a slight fatigue as the only side-effect.


But I will probably have to wait until summer because I am not a priority.

It seems to me that the MY CLONES block eliminates the need for workarounds.

Hm, wasn't the OP's problem with the block untitled script pic (13) that the list it reported was reordered each time one of the clones was clicked on?

Eh. Just capture it once and store it in a variable.