Discuss Scratch

LordEpical
Scratcher
4 posts

Clone number block

I think it would be good if there was a block called “Clone Number” (a reporter type block (round) ) that contains the number of a clone (ect. I cloned a sprite 3 times but I want each one of those clones to contain a number in order of which was created first)

Example in set variable: Set “Selected” to: join “Player” (Clone Number)

Last edited by LordEpical (May 26, 2013 18:19:12)

mitchboy
Scratcher
1000+ posts

Clone number block

There's a pretty simple workaround. Just use a script like this:
When I start as a clone
change (clone) by (1)

Last edited by mitchboy (May 26, 2013 19:31:38)

turkey3
Scratcher
1000+ posts

Clone number block

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.
kayybee
Scratcher
1000+ posts

Clone number block

mitchboy wrote:

There's a pretty simple workaround. Just use a script like this:
When I start as a clone
change (clone) by (1)
Do that, making clone a global variable.

Make cloneID a local variable, and do set cloneID to clone.

cloneID is its clone number.
turkey3
Scratcher
1000+ posts

Clone number block

kayybee 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)
Do that, making clone a global variable.

Make cloneID a local variable, and do set cloneID to clone.

cloneID is its clone number.
Local variables are shared amongst a sprite and all its clones; each clone doesn't have it's own.
kayybee
Scratcher
1000+ posts

Clone number block

turkey3 wrote:

kayybee 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)
Do that, making clone a global variable.

Make cloneID a local variable, and do set cloneID to clone.

cloneID is its clone number.
Local variables are shared amongst a sprite and all its clones; each clone doesn't have it's own.
Local variables are clone-local. Unless they changed it.

No, they couldn't have because my project “The Billion Button” still works and it depends on this.
LordEpical
Scratcher
4 posts

Clone number block

When using local variables that changes something (such as a colour) it only affects the original, un-cloned sprite. Also I cannot see a local block made for the clone, so I cannot make it identify a clone by storing a number inside it.
xlk
Scratcher
100+ posts

Clone number block

Do you mean a clone number, as in to know which clone is touching something? there is only a rather drastic way of doing it, which includes lists with the clones' coordinates and hit boxes…
iTweak0r
Scratcher
100+ posts

Clone number block

turkey3 wrote:

kayybee 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)
Do that, making clone a global variable.

Make cloneID a local variable, and do set cloneID to clone.

cloneID is its clone number.
Local variables are shared amongst a sprite and all its clones; each clone doesn't have it's own.
Clones do have their own, I proved that in Soundscape with the “My Note” variable

Last edited by iTweak0r (June 5, 2013 18:38:19)

kayybee
Scratcher
1000+ posts

Clone number block

LordEpical wrote:

When using local variables that changes something (such as a colour) it only affects the original, un-cloned sprite. Also I cannot see a local block made for the clone, so I cannot make it identify a clone by storing a number inside it.
Color isn't a local variable. It's a local property.
You don't need a local block for the clone. You have every single clone store a number.
xela888
Scratcher
99 posts

Clone number block

You know there are clones, right?
What I ALWAYS want is the block Clone ID. With the block, under the “when i start as a clone” block, you know which
clone is it.
Here's what the block would look like:
(clone id :: control)

Last edited by xela888 (June 15, 2015 18:28:43)

DaSpudLord
Scratcher
1000+ posts

Clone number block

That's a weird way for a block to look…

Anyway, no support, as you can use private variables.
xela888
Scratcher
99 posts

Clone number block

DaSpudLord wrote:

That's a weird way for a block to look…

Anyway, no support, as you can use private variables.
yea I know
thelucariokid
Scratcher
100+ posts

Clone number block

Support, because I don't know how to make the workaround.
-Io-
Scratcher
1000+ posts

Clone number block

change [cloneID v] by (1) // local variable
create clone of [myself v]

//example

when gf clicked
set [cloneID v] to [0]
repeat [3]
change [cloneID v] by (1)
create clone of [myself v]
end

when i start as a clone
if <(cloneID )= [1]> then
...
end
if <(cloneID )= [2]> then
...
end
if <(cloneID )= [3]> then
...
end
xela888
Scratcher
99 posts

Clone number block

-Io- wrote:

change [cloneID v] by (1) // local variable
create clone of [myself v]

//example

when gf clicked
set [cloneID v] to [0]
repeat [3]
change [cloneID v] by (1)
create clone of [myself v]
end

when i start as a clone
if <(cloneID )= [1]> then
...
end
if <(cloneID )= [2]> then
...
end
if <(cloneID )= [3]> then
...
end
Yea I know that, but I want it so you can use it later too.
DaSpudLord
Scratcher
1000+ posts

Clone number block

xela888 wrote:

-Io- wrote:

...
Yea I know that, but I want it so you can use it later too.
You can, just make clone# a local variable.
xela888
Scratcher
99 posts

Clone number block

DaSpudLord wrote:

xela888 wrote:

-Io- wrote:

...
Yea I know that, but I want it so you can use it later too.
You can, just make clone# a local variable.
Waht local Variable
DaSpudLord
Scratcher
1000+ posts

Clone number block

xela888 wrote:

DaSpudLord wrote:

xela888 wrote:

-Io- wrote:

...
Yea I know that, but I want it so you can use it later too.
You can, just make clone# a local variable.
Waht local Variable
When you create the variable, under the create variable dialog box, click the circle thats labeled “for this sprite only”. Then every time you clone that sprite, a clone of that variable is also created. That cloned variable can only be read and changed by the corresponding clone, and the clone can change the value of its variable independent of other clones' variables. (Variables for all sprites are not cloned)
xela888
Scratcher
99 posts

Clone number block

DaSpudLord wrote:

xela888 wrote:

DaSpudLord wrote:

xela888 wrote:

-Io- wrote:

...
Yea I know that, but I want it so you can use it later too.
You can, just make clone# a local variable.
Waht local Variable
When you create the variable, under the create variable dialog box, click the circle thats labeled “for this sprite only”. Then every time you clone that sprite, a clone of that variable is also created. That cloned variable can only be read and changed by the corresponding clone, and the clone can change the value of its variable independent of other clones' variables. (Variables for all sprites are not cloned)
Oh Thanks!!!!!!!!!!!!!!!!!

Powered by DjangoBB