Discuss Scratch

LeDerpy123
Scratcher
1000+ posts

Delete All Clones on This Sprite

I think that there should be a block that deletes all clones for a certain sprite. I think this would be useful because in my new project, Splash OS 4 which is unshared, I need a way do delete all clones at once and there is no real way to do it from within the one script for the clone.
delete all clones on [this sprite v]
What do you think?
CodeLegend
Scratcher
500+ posts

Delete All Clones on This Sprite

This would be helpful for some new scratchers.

But in the meantime, you could have a different broadcast channel for each sprite, for instance:
broadcast [Delete Sprite1 Clones v]

when I receive [Delete Sprite1 Clones v]//this script is in Sprite1
delete this clone

It's okay if the real ‘host’ sprite runs a [delete this sprite] script, because nothing happens.

Last edited by CodeLegend (Nov. 28, 2013 15:44:50)

LightningGuy
Scratcher
100+ posts

Delete All Clones on This Sprite

I think that would be really useful! On some of my projects, that I haven't shared for this reason, I was too lazy to spend the extra time to use a broadcast or whatever. I think this would be really useful, and most Scratchers would benefit.

when green flag clicked
repeat until <mouse down?>

delete this clone
end

Hopefully we don't have to do this script.
CodeLegend
Scratcher
500+ posts

Delete All Clones on This Sprite

LightningGuy wrote:

[scratchblocks]…
The script you made would not do anything. All clones are deleted when the flag is clicked, so it's impossible to have a [when flag clicked] block running inside of a clone.
Firedrake969
Scratcher
1000+ posts

Delete All Clones on This Sprite

No support.

CodeLegend wrote:

This would be helpful for some new scratchers.

But in the meantime, you could have a different broadcast channel for each sprite, for instance:
broadcast [Delete Sprite1 Clones v]

when I receive [Delete Sprite1 Clones v]//this script is in Sprite1
delete this clone

It's okay if the real ‘host’ sprite runs a script, because nothing happens.
This, basically. So many things would be helpful for new Scratchers, but just are too easy to workaround. Especially this workaround; it literally is three blocks.
CodeLegend
Scratcher
500+ posts

Delete All Clones on This Sprite

Firedrake969 wrote:

So many things would be helpful for new Scratchers, but just are too easy to workaround.
I completely agree!
LeDerpy123
Scratcher
1000+ posts

Delete All Clones on This Sprite

Ok. Thanks!
Photoguy77
Scratcher
100+ posts

Delete All Clones on This Sprite

I support!
JereTheJuggler
Scratcher
100+ posts

Delete All Clones on This Sprite

Couldn't you have the script you already have for your clones run in parallel with:
when I start as a clone
wait until <some condition is met>
delete this clone
to achieve the same effect?

You could have a variable for that condition that is normally set at 0. Whenever that condition would be met in your script, just change the value to 1 or some thing.
when I start as a clone
wait until <(is condition true?) = [1]>
set [ is condition true v] to [0]
delete this clone

Last edited by JereTheJuggler (Nov. 29, 2013 23:17:58)

CodeLegend
Scratcher
500+ posts

Delete All Clones on This Sprite

JeremiahMacDonald wrote:

Couldn't you have the script you already have for your clones run in parallel with:
[scratchblocks]
You could have a variable for that condition that is normally set at 0. Whenever that condition would be met in your script, just change the value to 1 or some thing.
[scratchblocks]
That would also work, but I still think a broadcast is easier.

Last edited by CodeLegend (Nov. 29, 2013 23:59:56)

Arolfselim
New Scratcher
1 post

Delete All Clones on This Sprite

JeremiahMacDonald wrote:

Couldn't you have the script you already have for your clones run in parallel with:
when I start as a clone
wait until <some condition is met>
delete this clone
to achieve the same effect?

You could have a variable for that condition that is normally set at 0. Whenever that condition would be met in your script, just change the value to 1 or some thing.
when I start as a clone
wait until <(is condition true?) = [1]>
set [ is condition true v] to [0]
delete this clone

Thank you very, very, much. For a beginner tens of answers to this question where incomprehensible. This solved my problem. My poject for week 0 is on its way now. My poject for week 0 is on its way now.
1234abcdcba4321
Scratcher
1000+ posts

Delete All Clones on This Sprite

If you don't want to clog up with broadcasts, then use just one:
when I receive [delete clones v]
if <(ID) = [F4785GVS22]> then // the code can be anything, just make sure all of them have their own unique code
delete this clone
end
One extra variable instead, but…
LeDerpy123
Scratcher
1000+ posts

Delete All Clones on This Sprite

Hmm… Sorta necroposting but okay. I already got my answer a while ago. I'm just gonna close this,

Last edited by LeDerpy123 (Jan. 10, 2014 01:36:29)

Powered by DjangoBB