Naming Clones

I am creating some clones and naming them in the following way. This works well. However, is there a more elegant way to do this that doesn't involve passing the name of the clone through a global variable (i.e., "Clone Name")?


You can make Clone Name a sprite-local variable (click the "for this sprite only" button in the Make a Variable dialog). Your code would still be the same, but each clone will have its own Clone Name variable.

By setting the "My Name" variable to the Clone's name, it is setting a variable to different values.

So maybe the "my name" variable would become "1", then "2", then "3", and so on.

My Name isn't a variable; it's a sprite attribute in the "my" submenu of SET.

Adding onto what bh said.

Sorry for the primitive by the way, I was experimenting with something else before bh said something, I think you could just use the normal set block.

Now that I look at it over and over again I just have a lot of leftover stuff, all that's important is the tell block and what its telling the sprite, a random item of my clones is irrelevant unless you're actually aiming for a random clone.

No. "My Name" isn't a variable, and that PRIMITIVE block can't set it. "My Name" is the name property of the sprite, the text that appears in the text box at the top of the scripting area, and also in the thumbnail in the sprite corral.

I created a sprite variable for myName, I didn't use the my > my name thing, sorry.

there's an extension primitive in v7 that lets you name anything that has a name, including costumes, sounds and clones:


Extension primitives aren't meant to be used stand-alone, but rather as building blocks for libraries. But here you go, you can build your own "set name" custom block around this.

"item (last) of my clones" !

untitled script pic - 2022-03-10T025720.621
untitled script pic - 2022-03-10T025728.165


bh example

jens example (no var inside the clone: using the real name of the clone to tell something to this clone)

var example (no var inside the clone: keep the reference to the clone in a variable (a list in this case) and use this reference to tell something to this clone)

if you really need a local var, i like the dardoro solution

Haha! I had forgotten about that one, thanks, Dariusz, for reminding me :joy:

Thanks for the many helpful suggestions for naming clones.

Dardaro's example strikes a good balance between efficiency and ease of understanding for novices. It also eliminates the need for the "Clone Name" variable that I had employed. Thanks to all!

Or, having gotten that far, it could all be done in one script.