Discuss Scratch

Crispydogs101
Scratcher
1000+ posts

Clone number block

Support since this would help check to see how many clones are there in the project and can help if there are reaching the 300 clone limit which can help with lag (and can help if you forgot to add a delete clone block at the end of the clone script)

I have it in something I cannot mention due to a policy. And it helped me a lot so if this was added to scratch it can help other users on scratch especially if they use a lot of clones.

Edit: queen of the page.

Last edited by Crispydogs101 (March 26, 2023 17:52:21)

climpard
Scratcher
3 posts

Clone number block

//removed blocks
comment @delInput[I was in scratch 1.2 beta. now... Scratch 3.0!]::grey
comment @addInput::grey

all at once{
}::control //based on the "warp" block in Snap!

proc {a block::motion}::events hat

when<>is true::control hat

stop all @stopSign ::control cap

stop script::control cap

(abs()::operators)

//ScratchBoard

motor on::#4d5eff
motor off::#4d5eff
motor on for () seconds::#4d5eff
motor power (100)::#4d5eff

motor direction[this way v]::#4d5eff
motor direction[that way v]::#4d5eff
motor direction[reverse v]::#4d5eff

([slider v]sensor value::sensing)
<sensor [button pressed v]?::sensing>

Last edited by climpard (March 26, 2023 18:25:43)

climpard
Scratcher
3 posts

Clone number block

Last edited by climpard (March 26, 2023 18:28:10)

medians
Scratcher
1000+ posts

Clone number block

Crispydogs101 wrote:

Support since this would help check to see how many clones are there in the project and can help if there are reaching the 300 clone limit which can help with lag (and can help if you forgot to add a delete clone block at the end of the clone script)
Yeah, it’s nicer than having change variable by 1 in every single cloned sprite and having to set it to 0 every single time
Maybe also like this?
(clones in [project v] ::control)

(clones in [this sprite v] ::control)

(clones in [other sprite v] ::control)

climpard wrote:

blocks ::grey
Please use the scratchblocks testing sticky in Help with Scripts for this.

Last edited by medians (March 26, 2023 18:33:50)

Crispydogs101
Scratcher
1000+ posts

Clone number block

medians wrote:

Crispydogs101 wrote:

Support since this would help check to see how many clones are there in the project and can help if there are reaching the 300 clone limit which can help with lag (and can help if you forgot to add a delete clone block at the end of the clone script)
Yeah, it’s nicer than having change variable by 1 in every single cloned sprite and having to set it to 0 every single time
Maybe also like this?
(clones in [project v] ::control)

(clones in [this sprite v] ::control)

(clones in [other sprite v] ::control)
Yeah that's a good idea as well since it can have many uses (like if there was a bit too much clones that boolen would delete it all up)
medians
Scratcher
1000+ posts

Clone number block

Bringing this topic up.
rdococ
Scratcher
1000+ posts

Clone number block

This block can be implemented in a way that doesn't have an easy workaround. Consider this:

// In a clonable sprite:
when I start as a clone
add (clone id :: control) to [clones v]

// Elsewhere:
<touching (item (n) of [clones v]) ?>
([attack power v] of (item (n) of [clones v]))

If clone IDs were unique across the project instead of per-sprite, Scratch could support them in sprite dropdowns. Now if you want to share data between clones, you only need a list of clone IDs instead of lists for every single attribute you want to share - very useful for advanced projects and arguably makes them simpler to understand.

Last edited by rdococ (Nov. 1, 2023 14:57:52)

mpj0220
Scratcher
12 posts

Clone number block

turkey3 wrote:

mitchboy wrote:

There's a pretty simple workaround. Just use a script like this:
When I start as a clone
change (clone) by (1)
That shows how many clones there are in total but not an individual clone's number.

when a clone is created, it can only see the value a variable was when it was created. for example, if you use a script like this:
change [clones v] by (1)
create clone of [myself v]

if each clone says the value of the variable, each clone will respond with their version of that variable.
123m83
Scratcher
100+ posts

Clone number block

Bump because dupe
MagicCoder330
Scratcher
1000+ posts

Clone number block

I'd assume that if it wasn't a clone it would return zero. If so, I support this a lot. it would help me with a project.
missingmodel821
Scratcher
100+ posts

Clone number block

support bc we need a way to differentiate between the main sprite and clones/ clones from each other

Last edited by missingmodel821 (June 10, 2025 20:00:23)

ThatOneCoder435
Scratcher
100+ posts

Clone number block

support, also some ideas of mine

when I start as a clone with ID ()::control hat // self explanatory

clone id::control reporter // reports nothing if not a clone, reports the clone number based on chronological order of creation/number of clones

number of clones in [ v]::control reporter // clones in sprite

([thing v] of clone with ID ()::control reporter // reports variables, position, size etc - similar to "thing of thing"

[thing v] of clones in [ v] as [ v]::control reporter // similar to the previous block but reports all info of a certain thing as an array or separated by spaces

delete all clones of [ v]::control // deletes clones of sprite

delete clone with ID ()::control

delete clone in [ v] with ID ()::control

is [clone v]?::control boolean // is clone or parent

Powered by DjangoBB