Discuss Scratch

SuperPancake64
Scratcher
22 posts

Clone Detector

Dear Scratch Team

I think you should make an input block that detects how many clones of a specific sprite there are and what number a specific clone is.

I am trying to make a Minecraft-like game on scratch, but I don't know how to give each individual clone of a block it's own x-axis, y-axis and z-axis data. The only way I can think of is to use a list, but I don't know how each clone will know which part of the list belongs to it! Please help!

Sincerely,
SuperPankake64

Last edited by SuperPancake64 (Dec. 30, 2019 05:53:47)

PrincessFlowerTV
Scratcher
1000+ posts

Clone Detector

Sorry, but this kind of topic doesn't really fit the forum “Requests”. I'll request for it to be moved to “Suggestions”, which is probably a better fit for this topic.

Got to be good looking cause he's so hard to see -The Beatles

(Thank you @just-there from The Profile Picture Shop for the banner ^^)





Nothing's down here, sorry to disappoint you.






JK. there may be something down there…









Maybe not, tho.











You're determined, aren't you?













Talar du Svenska? Om inte, det ar fin.





















Just stop it, will ya?

































Fine, you win.




Take a rice cake. *yeets you a rice cake*
Say “Thanks for that rice cake, Kewpie!” if you made it this far.
SuperPancake64
Scratcher
22 posts

Clone Detector

PrincessFlowerTV wrote:

Sorry, but this kind of topic doesn't really fit the forum “Requests”. I'll request for it to be moved to “Suggestions”, which is probably a better fit for this topic.



Sorry! I've never used the forum before!
PrincessFlowerTV
Scratcher
1000+ posts

Clone Detector

SuperPancake64 wrote:

PrincessFlowerTV wrote:

Sorry, but this kind of topic doesn't really fit the forum “Requests”. I'll request for it to be moved to “Suggestions”, which is probably a better fit for this topic.



Sorry! I've never used the forum before!
It's okay; it's an honest mistake. Just make sure you read the description of the sub-forum to make sure the topic fits next time.

Got to be good looking cause he's so hard to see -The Beatles

(Thank you @just-there from The Profile Picture Shop for the banner ^^)





Nothing's down here, sorry to disappoint you.






JK. there may be something down there…









Maybe not, tho.











You're determined, aren't you?













Talar du Svenska? Om inte, det ar fin.





















Just stop it, will ya?

































Fine, you win.




Take a rice cake. *yeets you a rice cake*
Say “Thanks for that rice cake, Kewpie!” if you made it this far.
WindOctahedron
Scratcher
1000+ posts

Clone Detector

SuperPancake64 wrote:

I think you should make an input block that detects how many clones of a specific sprite there are and what number a specific clone is.
There exists a workaround:
when green flag clicked
set [id v] to [0] // The variable must be private.
repeat (some times)
change [id v] by (1)
create clone of [myself v]
end
set [number of clones v] to (length of [list v] :: list)
when I start as a clone
insert [any data about your clones] at (id) of [list v]
forever
replace item (id) of [list v] with [any data that would update]
end

The message above may contain wrong information, rude remarks, or something embarrassing to my current self. In this case, please ignore it and remember that I likely wrote it back when I didn't know what “respect” truly meant. I really hate thinking about it again.
SuperPancake64
Scratcher
22 posts

Clone Detector

WindOctahedron wrote:

SuperPancake64 wrote:

I think you should make an input block that detects how many clones of a specific sprite there are and what number a specific clone is.
There exists a workaround:
when green flag clicked
set [id v] to [0] // The variable must be private.
repeat (some times)
change [id v] by (1)
create clone of [myself v]
end
set [number of clones v] to (length of [list v] :: list)
when I start as a clone
insert [any data about your clones] at (id) of [list v]
forever
replace item (id) of [list v] with [any data that would update]
end

no i mean like is this clone the 7th one that was made since the start flag was clicked
WindOctahedron
Scratcher
1000+ posts

Clone Detector

SuperPancake64 wrote:

WindOctahedron wrote:

SuperPancake64 wrote:

I think you should make an input block that detects how many clones of a specific sprite there are and what number a specific clone is.
There exists a workaround:
when green flag clicked
set [id v] to [0] // The variable must be private.
repeat (some times)
change [id v] by (1)
create clone of [myself v]
end
set [number of clones v] to (length of [list v] :: list)
when I start as a clone
insert [any data about your clones] at (id) of [list v]
forever
replace item (id) of [list v] with [any data that would update]
end

no i mean like is this clone the 7th one that was made since the start flag was clicked
Easy!
when I receive [Detect! v]
if <(id) = [7]> then
...
end
Also, just an update:
define create (number) clones
set [id v] to (counter) // private
repeat (number :: custom arg)
change [counter v] by (1) // not private; it's here because if you set the id to 0, the variable will reset
change [id v] by (1)
create clone of [myself v]
end
set [id v] to [0] // This is here, because if you use my script above, the sprite can also execute the command. With this, it is safer.

Last edited by WindOctahedron (June 21, 2019 07:59:26)


The message above may contain wrong information, rude remarks, or something embarrassing to my current self. In this case, please ignore it and remember that I likely wrote it back when I didn't know what “respect” truly meant. I really hate thinking about it again.
Nambaseking01
Scratcher
1000+ posts

Clone Detector

The scripts people have given you will work, but there is a 300 clone limit on Scratch projects.

Anyways, support. I really think this will help people make Minecraft type of games.

Hey there! My name is Nammy. I'm a male Forum Helper and Scratch Wiki Editor.
Profile | Test Account | Talk with me here! | Griffpatch is quitting Scratch?!
Botcho_Otkho
Scratcher
1000+ posts

Clone Detector

WindOctahedron wrote:

Also, just an update:
define create (number) clones
set [id v] to (counter) // private
repeat (number :: custom arg)
change [counter v] by (1) // not private; it's here because if you set the id to 0, the variable will reset
change [id v] by (1)
create clone of [myself v]
end
set [id v] to [0] // This is here, because if you use my script above, the sprite can also execute the command. With this, it is safer.
I'd have done this:
define create (number) clones
set [id v] to [0]
repeat (number)
change [id v] by (1)
create clone of [myself v]
end
set [id v] to [0]
I think it uses less variables.
I don't understand why you used “counter”; could you explain to me, please?

I see now that the circumstances of one's birth are irrelevant. It is what you do with the gift of life that determines who you are. - Mewtwo
Nambaseking01
Scratcher
1000+ posts

Clone Detector

Botcho_Othko wrote:

~snip~
I'd have done this:
define create (number) clones
set [id v] to [0]
repeat (number)
change [id v] by (1)
create clone of [myself v]
end
set [id v] to [0]
I think it uses less variables.
I don't understand why you used “counter”; could you explain to me, please?

They added Counter so the Id does not reset to 0 every time the loop starts. That was pointless, because the value was set to 0 outside the loop — I think they forgot. Your way is faster and more efficient.

Hey there! My name is Nammy. I'm a male Forum Helper and Scratch Wiki Editor.
Profile | Test Account | Talk with me here! | Griffpatch is quitting Scratch?!
Botcho_Otkho
Scratcher
1000+ posts

Clone Detector

Nambaseking01 wrote:

They added Counter so the Id does not reset to 0 every time the loop starts. That was pointless, because the value was set to 0 outside the loop
Oh, I see.
To make it work, I'd do this:
when green flag clicked
set [counter v] to [0]
...

define create (number) clones
set [id v] to (counter)
repeat (number :: custom arg)
change [counter v] by (1)
change [id v] by (1)
create clone of [myself v]
end

Last edited by Botcho_Otkho (June 23, 2019 12:20:04)


I see now that the circumstances of one's birth are irrelevant. It is what you do with the gift of life that determines who you are. - Mewtwo
Nambaseking01
Scratcher
1000+ posts

Clone Detector

Botcho_Otkho wrote:

~snip~
Oh, I see.

Glad to teach you!

Hey there! My name is Nammy. I'm a male Forum Helper and Scratch Wiki Editor.
Profile | Test Account | Talk with me here! | Griffpatch is quitting Scratch?!
SuperPancake64
Scratcher
22 posts

Clone Detector

Botcho_Otkho wrote:

WindOctahedron wrote:

Also, just an update:
define create (number) clones
set [id v] to (counter) // private
repeat (number :: custom arg)
change [counter v] by (1) // not private; it's here because if you set the id to 0, the variable will reset
change [id v] by (1)
create clone of [myself v]
end
set [id v] to [0] // This is here, because if you use my script above, the sprite can also execute the command. With this, it is safer.
I'd have done this:
define create (number) clones
set [id v] to [0]
repeat (number)
change [id v] by (1)
create clone of [myself v]
end
set [id v] to [0]
I think it uses less variables.
I don't understand why you used “counter”; could you explain to me, please?
they need to update the blocks that you can use in the forum to the 3.0 blocks lol.

Last edited by SuperPancake64 (June 22, 2019 19:33:24)

SuperPancake64
Scratcher
22 posts

Clone Detector

when green flag clicked
[Update the forum]

Last edited by SuperPancake64 (June 22, 2019 19:37:01)

Troyer_Kem
Scratcher
1000+ posts

Clone Detector

SuperPancake64 wrote:

They need to update the blocks that you can use in the forum to the 3.0 blocks lol.
Yeah. Some blocks are missing in forum blocks. Like pitch.

If you're seeing this account, I'm Morimop and the reason that I use this account is:

**I'm too lazy to switch accounts**
**I forget my password**
**I got a forum message while drawing something**
WindOctahedron
Scratcher
1000+ posts

Clone Detector

Botcho_Otkho and Nambaseking01 wrote:

Basically “The id reset is pointless”.
I just added the id reset so that when adressing the last clone that is created, the sprite itself isn't adressed (because the sprite's id is 0).

The message above may contain wrong information, rude remarks, or something embarrassing to my current self. In this case, please ignore it and remember that I likely wrote it back when I didn't know what “respect” truly meant. I really hate thinking about it again.
WindOctahedron
Scratcher
1000+ posts

Clone Detector

Troyer_Kem wrote:

SuperPancake64 wrote:

they need to update the blocks that you can use in the forum to the 3.0 blocks lol.
when green flag clicked
[Update the forum] :: #dd0000 stack
Yeah. Some blocks are missing in forum blocks. Like pitch.
Please, don't blockspam or hijack threads. Create your own topics and discuss it there.
If you really want to blockspam, do it here.

Last edited by WindOctahedron (June 23, 2019 09:56:57)


The message above may contain wrong information, rude remarks, or something embarrassing to my current self. In this case, please ignore it and remember that I likely wrote it back when I didn't know what “respect” truly meant. I really hate thinking about it again.
Nambaseking01
Scratcher
1000+ posts

Clone Detector

Botcho_Otkho wrote:

-snip-
To make it work, I'd do this:
when green flag clicked
set [id v] to [0]
...

define create (number) clones
set [id v] to (counter)
repeat (number :: custom arg)
change [counter v] by (1)
change [id v] by (1)
create clone of [myself v]
end

Err, shouldn't the Counter variable be set to 0 and not the Id? I am confused.

Hey there! My name is Nammy. I'm a male Forum Helper and Scratch Wiki Editor.
Profile | Test Account | Talk with me here! | Griffpatch is quitting Scratch?!
Botcho_Otkho
Scratcher
1000+ posts

Clone Detector

Nambaseking01 wrote:

Err, shouldn't the Counter variable be set to 0 and not the Id? I am confused.
Whoops. Sorry, it should.

WindOctahedron wrote:

Botcho_Otkho and Nambaseking01 wrote:

Basically “The id reset is pointless”.
I just added the id reset so that when adressing the last clone that is created, the sprite itself isn't adressed (because the sprite's id is 0).
But then, there would be more clones with the same ID.

Last edited by Botcho_Otkho (June 23, 2019 12:21:18)


I see now that the circumstances of one's birth are irrelevant. It is what you do with the gift of life that determines who you are. - Mewtwo
Nambaseking01
Scratcher
1000+ posts

Clone Detector

WindOctahedron wrote:

-snip-
I just added the id reset so that when adressing the last clone that is created, the sprite itself isn't adressed (because the sprite's id is 0).

Still, you could have set it to 0 below a When clicked event and then attach the Define block to it, if you know what I mean.

Hey there! My name is Nammy. I'm a male Forum Helper and Scratch Wiki Editor.
Profile | Test Account | Talk with me here! | Griffpatch is quitting Scratch?!

Powered by DjangoBB