Discuss Scratch
- SurgeForce
-
100+ posts
"When I receive as a clone" block
Clones can't receive broadcasts.
when I receive [message1 v] as clone::events hat
- Zro716
-
1000+ posts
"When I receive as a clone" block
Yes they can. The thing is you need to discern the parent from the clone by using a var for recognition of either (isClone?): Clones can't receive broadcasts.
when I receive [message v]
if <(isClone?) = [true]> then
script for a clone ::grey
else
script for the parent sprite ::grey //optional
end
- UndeadSorcerer
-
100+ posts
"When I receive as a clone" block
In the game I am making I have a lot of variables. Mainly just because of the when I receive script. It goes to clones too so it makes clones do things you don't want them to do. I have about 20 variables and it is very confusing. Here is what I am suggesting:
You can change clone to:
I think this will be a useful block.
when [clone v] receive [message1 v] :: hat events
You can change clone to:
when [original v] receive [message1 v] :: hat events
I think this will be a useful block.
Last edited by Paddle2See (Oct. 13, 2023 08:35:00)
- stickfiregames
-
1000+ posts
"When I receive as a clone" block
Maybe support, although you can just use a clone ID system and have
when I receive [message v]
if <(clone id) = [0]> then
original stuff :: grey
else
clone stuff :: grey
end
- matey1234
-
1000+ posts
"When I receive as a clone" block
this. Maybe support, although you can just use a clone ID system and havewhen I receive [message v]
if <(clone id) = [0]> then
original stuff :: grey
else
clone stuff :: grey
end
- JavaFernOS
-
100+ posts
"When I receive as a clone" block
support! Every complex clone scratcher really needs this to prevent a little lag. 

- Really_A
-
1000+ posts
"When I receive as a clone" block
I change my mind. Support!
Last edited by Really_A (March 21, 2015 07:27:05)
- Cyoce
-
500+ posts
"When I receive as a clone" block
No support for the dropdown receive block. As has been mentioned above, a clone-ID system allows for easy implementation of this. Not to mention the fact that most projects that would need to distinguish clones from the original sprite should probably be using a clone-ID system anyway.
Additionally, putting a dropdown on the “when I receive [ v]” block could be confusing and might (slightly) increase file size (when not using a clone system, which is true for most project).
My suggestion to circumvent the confusion is to have a new block (as opposed to modifying a current one):
Additionally, putting a dropdown on the “when I receive [ v]” block could be confusing and might (slightly) increase file size (when not using a clone system, which is true for most project).
My suggestion to circumvent the confusion is to have a new block (as opposed to modifying a current one):
When I receive [message1 v] as a clone :: control hatThis would keep the existing receive block untouched, and add all the functionality of the suggested dropdown block.
Last edited by Cyoce (March 21, 2015 04:33:12)
- kvackkvack
-
500+ posts
"When I receive as a clone" block
Make a new variable, but make it “for this sprite only”. Call it something like “clone?”.
In the main script, set clone? to 0, but inn the clones script, set clone? to 1.
When you want to check if a clone has received the broadcast, add an if-statement that checks if “clone?” is 1, because then it is a clone.
The trick here is that “for this sprite only” (I'll call them local from now on) variables, are not only local to the sprite… but also for each and every clone.
In the main script, set clone? to 0, but inn the clones script, set clone? to 1.
When you want to check if a clone has received the broadcast, add an if-statement that checks if “clone?” is 1, because then it is a clone.
The trick here is that “for this sprite only” (I'll call them local from now on) variables, are not only local to the sprite… but also for each and every clone.
Last edited by kvackkvack (March 21, 2015 10:52:00)
- Tommy100
-
100+ posts
"When I receive as a clone" block
when I receive [ v] as a clone :: hat controlI've always had a struggle receiving messages with clones. Sure, you can use a variable, but the block above would make it so much more simpler! This way clones could receive messages the same as sprites can!

- Supports: 2
@Aboot4
@Critic2100
Last edited by Tommy100 (June 19, 2015 16:06:12)
- dude341
-
1000+ posts
"When I receive as a clone" block
when I receive [ v]Works for clones. ST, please close this topic.
- Tommy100
-
100+ posts
"When I receive as a clone" block
Hey, that wasn't very nice!when I receive [ v]Works for clones. ST, please close this topic.

- Aboot4
-
100+ posts
"When I receive as a clone" block
No it doesn't. Why don't you reread what Tommy asked for again before making accusations? You misunderstood what he was saying. He wants the certain clone to receive the message, not receive the message then do clone stuff. He doesn't mean this:when I receive [ v]Works for clones. ST, please close this topic.
when I receive [Blah v]Nothing like that. He means this:
create clone of [myself v]
when I receive [Blah v] as a clone :: hat controlIf you tried to do it the way YOU thought he meant, you'd have to do something like this:
delete this clone
when green flag clicked
forever
create clone of [myself v]
change [CloneID v] by (1)
wait (2) secs
end
when I receive [Blah v]
[Delete Clone - ID: (ID)
[scratchblocks]
define Delete Clone - ID: (ID)
Delete Clone (ID)
[/scratchblocks]
AS YOU CAN SEE, it is VERY difficult to allow a clone to receive a message without the block Tommy wants. I couldn't even figure out a workaround, so I made up a fake block above (:P). Still, try to be nice, okay? It's a good idea, Tommy. Support.
Last edited by Aboot4 (June 19, 2015 16:05:46)
- Tommy100
-
100+ posts
"When I receive as a clone" block
Thanks!No it doesn't. Why don't you reread what Tommy asked for again before making accusations? You misunderstood what he was saying. He wants the certain clone to receive the message, not receive the message then do clone stuff. He doesn't mean this:when I receive [ v]Works for clones. ST, please close this topic.when I receive [Blah v]Nothing like that. He means this:
create clone of [myself v]when I receive [Blah v] as a clone :: hat controlIf you tried to do it the way YOU thought he meant, you'd have to do something like this:
delete this clonewhen green flag clicked
forever
create clone of [myself v]
change [CloneID v] by (1)
wait (2) secs
end
when I receive [Blah v]
[Delete Clone - ID: (ID)define Delete Clone - ID: (ID)
Delete Clone (ID)
AS YOU CAN SEE, it is VERY difficult to allow a clone to receive a message without the block Tommy wants. I couldn't even figure out a workaround, so I made up a fake block above (). Still, try to be nice, okay? It's a good idea, Tommy. Support.

- Aboot4
-
100+ posts
"When I receive as a clone" block
Actually, there IS a way around:
when green flag clicked
set [Delete v] to [0]
when I receive [Delete Clone v]
change [Delete v] by (1)
when I start as a clone
forever
if <(Delete) = [1]> then
delete this clone
end
end
Last edited by Aboot4 (June 19, 2015 16:08:10)
- seanbobe
-
500+ posts
"When I receive as a clone" block
when green flag clicked
set [clone? v] to [0] // clone? is sprite only
when I start as a clone
change [clone? v] by (1)
when I receive [Message1 as a clone v]
if <(clone?) = [1]> then
...
end
- Znapi
-
500+ posts
"When I receive as a clone" block
The block is too specific for me. It is too easy to create a variable, plus if you want to attach IDs to your clones(for the many useful reasons), you are going to have a variable for each clone anyway.
- stickfiregames
-
1000+ posts
"When I receive as a clone" block
No support, too specific. I might support
<I am a clone? :: sensing>which could be used in more ways, and would let you work around this with
when I receive [message v]
if <I am a clone? :: sensing> then
...
end