Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Trouble with the broadcast block. (I'm bad at coding but I'm trying to code without tutorials)
- Sekomek
- Scratcher
6 posts
Trouble with the broadcast block. (I'm bad at coding but I'm trying to code without tutorials)
I use a code for generating squares:
define (without screen refresh):
show
go to x: y:
repeat until touching color (basically I have a grey line at the bottom of the project so it stops):
I repeat :
I I create a clone of myself
I I change x by
I I________I
I set x to
I change y by
I____________________________________________________________________________I
hide
stop this script
I made a code where every -32 in y the player moves 32 up and sands a signal “up” so the squares move up and a new layer generates. If you run the code manualy it works but when you put it in a "when i recieve " block it breaks (clones go up to the 300 limit and the block is just moving, swiching lanse up and down):
when i recieve
show
go to x: y:
repeat :
I create a clone of myself
I change x by
I________I
set x to
change y by
Important to note the squares and the player are 32 by 32 cubes
(Probably deleting this later)
define (without screen refresh):
show
go to x: y:
repeat until touching color (basically I have a grey line at the bottom of the project so it stops):
I repeat :
I I create a clone of myself
I I change x by
I I________I
I set x to
I change y by
I____________________________________________________________________________I
hide
stop this script
I made a code where every -32 in y the player moves 32 up and sands a signal “up” so the squares move up and a new layer generates. If you run the code manualy it works but when you put it in a "when i recieve " block it breaks (clones go up to the 300 limit and the block is just moving, swiching lanse up and down):
when i recieve
show
go to x: y:
repeat :
I create a clone of myself
I change x by
I________I
set x to
change y by
Important to note the squares and the player are 32 by 32 cubes
(Probably deleting this later)
- Sekomek
- Scratcher
6 posts
Trouble with the broadcast block. (I'm bad at coding but I'm trying to code without tutorials)
I wanted to say that the computer science books from this year (yes im 13) recently stopped working do to this broadcast block
- SpyCoderX
- Scratcher
100+ posts
Trouble with the broadcast block. (I'm bad at coding but I'm trying to code without tutorials)
Could you share the project?
New game! (link)
Have a good day/night!
\(-_-) ::#00AAAA //This is crypto. He protects my signature from the evil kumquats!Programming is a very powerful skill. As are critical thinking and hard work.
- SpyCoderX
- ramenecho
- Scratcher
100+ posts
Trouble with the broadcast block. (I'm bad at coding but I'm trying to code without tutorials)
Can you please convert this to scratch blocks? Like this for example I use a code for generating squares:
define (without screen refresh):
show
go to x: y:
repeat until touching color (basically I have a grey line at the bottom of the project so it stops):
I repeat :
I I create a clone of myself
I I change x by
I I________I
I set x to
I change y by
I____________________________________________________________________________I
hide
stop this script
I made a code where every -32 in y the player moves 32 up and sands a signal “up” so the squares move up and a new layer generates. If you run the code manualy it works but when you put it in a "when i recieve " block it breaks (clones go up to the 300 limit and the block is just moving, swiching lanse up and down):
when i recieve
show
go to x: y:
repeat :
I create a clone of myself
I change x by
I________I
set x to
change y by
Important to note the squares and the player are 32 by 32 cubes
(Probably deleting this later)
when green flag clickedJust hit that little blue block icon in that bar at the top, you can also use the check to get a preview of that code, to display a comment in the code just use a //
if <using text to describe code> then
broadcast [cant read v]
end
Hello there, this is a cool signature! You can even make your own wow! I really need somebody to check my game for bugs, MineQuest Idle its not the highest quality of games, but its an improvement from my previous ones
- bungamer07
- Scratcher
100+ posts
Trouble with the broadcast block. (I'm bad at coding but I'm trying to code without tutorials)
define without screen refresh
show
go to x: () y: ()
repeat until <touching color []?> //basically I have a grey line at the bottom of the project so it stops
repeat ()
create a clone of [myself v] :: events
change x by ()
end
set x to ()
change y by ()
end
hide
stop [this script v]
//I made a code where every -32 in y the player moves 32 up and sands a signal “up” so the squares move up and a new layer generates. If you run the code manualy it works but when you put it in a "when i recieve " block it breaks (clones go up to the 300 limit and the block is just moving, swiching lanse up and down):
when i receive [ v]
show
go to x: () y: ()
repeat ()
create a clone of [myself v] :: events
change x by ()
end
set x to ()
change y by ()
when [I v] send a post :: pen hatHi welcome to my signature
if <(post type :: pen) = [question]> then
wait until <solution is found? :: pen>
post [Thanks!] :: pen
end
This is where I can do whatever
Here's my pet (and their toy)
^w^ ::control//hiThey help me defend my signature
() :: #000000 reporter
v kumquat prison v
PRISON(◉︵◉)(◉︵◉)(◉︵◉):: #444444
⠀⠀ ⠀ ⠀ ⠀(◉︵◉)(◉︵◉)(◉︵◉):: #444444
MAX SECURITY(((((((((((((((((((⋋_⋌))))))))))))))))))) :: #664444
- ramenecho
- Scratcher
100+ posts
Trouble with the broadcast block. (I'm bad at coding but I'm trying to code without tutorials)
Okay, common problem here, easy solution, just put the entire block into something like this and have every clone set the id variable to 1 when they spawndefine without screen refresh
show
go to x: () y: ()
repeat until <touching color []?> //basically I have a grey line at the bottom of the project so it stops
repeat ()
create a clone of [myself v] :: events
change x by ()
end
set x to ()
change y by ()
end
hide
stop [this script v]
//I made a code where every -32 in y the player moves 32 up and sands a signal “up” so the squares move up and a new layer generates. If you run the code manualy it works but when you put it in a "when i recieve " block it breaks (clones go up to the 300 limit and the block is just moving, swiching lanse up and down):
when i receive [ v]
show
go to x: () y: ()
repeat ()
create a clone of [myself v] :: events
change x by ()
end
set x to ()
change y by ()
when I start as a clone
set [Id v] to [1]//this basically gives a way to differentiate between clones and the original sprite.
//You can also have the id set to a different number under specific conditions to make it so you can give specific clones unique processes
if <(id) = [0]> then //set id to for this sprite only and have the main sprite set it to 0 at the start
//insert your entire script in this (if) block, do this for both the custom block and the broadcast block, this will prevent the clones from creating other clones
This should work, if it doesn’t then please tell me! Im happy to help out.
P.S. i can tell by the code you are making a system that fills a specific area with a grid of squares, nice job with it, most of the time when i see code like that it is not very efficient but you did great!
Hello there, this is a cool signature! You can even make your own wow! I really need somebody to check my game for bugs, MineQuest Idle its not the highest quality of games, but its an improvement from my previous ones
- Sekomek
- Scratcher
6 posts
Trouble with the broadcast block. (I'm bad at coding but I'm trying to code without tutorials)
Okay, common problem here, easy solution, just put the entire block into something like this and have every clone set the id variable to 1 when they spawndefine without screen refresh
show
go to x: () y: ()
repeat until <touching color []?> //basically I have a grey line at the bottom of the project so it stops
repeat ()
create a clone of [myself v] :: events
change x by ()
end
set x to ()
change y by ()
end
hide
stop [this script v]
//I made a code where every -32 in y the player moves 32 up and sands a signal “up” so the squares move up and a new layer generates. If you run the code manualy it works but when you put it in a "when i recieve " block it breaks (clones go up to the 300 limit and the block is just moving, swiching lanse up and down):
when i receive [ v]
show
go to x: () y: ()
repeat ()
create a clone of [myself v] :: events
change x by ()
end
set x to ()
change y by ()when I start as a clone
set [Id v] to [1]//this basically gives a way to differentiate between clones and the original sprite.
//You can also have the id set to a different number under specific conditions to make it so you can give specific clones unique processes
if <(id) = [0]> then //set id to for this sprite only and have the main sprite set it to 0 at the start
//insert your entire script in this (if) block, do this for both the custom block and the broadcast block, this will prevent the clones from creating other clones
This should work, if it doesn’t then please tell me! Im happy to help out.
P.S. i can tell by the code you are making a system that fills a specific area with a grid of squares, nice job with it, most of the time when i see code like that it is not very efficient but you did great!
It worked, thank you very much, I couldn't have done it without your help. I realise that I have a lot to learn from other people.
- ramenecho
- Scratcher
100+ posts
Trouble with the broadcast block. (I'm bad at coding but I'm trying to code without tutorials)
It worked, thank you very much, I couldn't have done it without your help. I realise that I have a lot to learn from other people.
Your welcome, i am happy to help as much as possible, great thing about this is every bug and issue you fix, you get better at coding because your less likely to make that mistake again in the future. So keep coding, your doing great
Hello there, this is a cool signature! You can even make your own wow! I really need somebody to check my game for bugs, MineQuest Idle its not the highest quality of games, but its an improvement from my previous ones
- DaniePlayz1234
- Scratcher
11 posts
Trouble with the broadcast block. (I'm bad at coding but I'm trying to code without tutorials)
Usually when this happens, it's with clones. When you broadcast something, it does it for the OG Sprite and the clones. When you use a custom block, it only does it for whichever sprite used the block. Instead, I suggest to use a custom block with “Run without screen refresh” on.
- Discussion Forums
- » Help with Scripts
- » Trouble with the broadcast block. (I'm bad at coding but I'm trying to code without tutorials)