Discuss Scratch
- Discussion Forums
- » Suggestions
- » Custom c blocks and hat blocks
- Nambaseking01
- Scratcher
1000+ posts
Custom c blocks and hat blocks
when green flag clicked
forever
if <...> then
repeat until <not <...>>
...
end
end
end
Please explain clearly what this is - I understand this is a workaround but others might not.
—
What? I do not understand this suggestion at all, could someone please elaborate? I am not trying to be offensive or anything, just asking.
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?!
Profile | Test Account | Talk with me here! | Griffpatch is quitting Scratch?!
- munchcraft
- Scratcher
8 posts
Custom c blocks and hat blocks
Hey! Can u add a feature so we can make loops as custom blocks?
The best scratcher on earth. Lets get to #1 most followed BOI
- ThatOneWeirdDude
- Scratcher
1000+ posts
Custom c blocks and hat blocks
What makes you the decision maker? No, Sorrydefine nope
I'll report this to be moved to suggestions for you. Don't worry
- EZ-Games
- Scratcher
1000+ posts
Custom c blocks and hat blocks
Hey there! For any suggestions you have for Scratch, please post them all in Suggestions forum. It's fine if you didn't know that all the suggestions go there, just letting you know now so you won't do it again.
I'll ask the Scratch Team to move this topic over to the Suggestions forum.
Now for your suggestion:
Are you asking to make these blocks:
Turn into this?:
I'll ask the Scratch Team to move this topic over to the Suggestions forum.
Now for your suggestion:
Are you asking to make these blocks:
forever
end
repeat until <>
end
Turn into this?:
forever :: custom blocksSorry if this is a silly question.
end
repeat until <> :: custom blocks
end
God did not send his Son into the world to condemn the world, but to save the world through him.
John 3:17
Advice:
Saying “Support” or “No Support” doesn't contribute anything to the conversation.
A question that has already been answered doesn't need to be answered twice with the same answer - bring something new to the table.
- munchcraft
- Scratcher
8 posts
Custom c blocks and hat blocks
What makes you the decision maker? No, Sorrydefine nope
I'll report this to be moved to suggestions for you. Don't worry
thanks.
The best scratcher on earth. Lets get to #1 most followed BOI
- munchcraft
- Scratcher
8 posts
Custom c blocks and hat blocks
Suggestions forum. It's fine if you didn't know that all the suggestions go there, just letting you know now so you won't do it again.U R Rite Hey there! For any suggestions you have for Scratch, please post them all in
I'll ask the Scratch Team to move this topic over to the Suggestions forum.
Now for your suggestion:
Are you asking to make these blocks:forever
end
repeat until <>
end
Turn into this?:forever :: custom blocksSorry if this is a silly question.
end
repeat until <> :: custom blocks
end
The best scratcher on earth. Lets get to #1 most followed BOI
- EZ-Games
- Scratcher
1000+ posts
Custom c blocks and hat blocks
Alright. -snip-
U R Rite
I think we should keep the loop blocks in the control section of blocks. Custom blocks are meant for blocks that are made by the Scratcher. The “forever” and “repeat until <>” blocks are just blocks that help control your script, they aren't made by the Scratcher.
God did not send his Son into the world to condemn the world, but to save the world through him.
John 3:17
Advice:
Saying “Support” or “No Support” doesn't contribute anything to the conversation.
A question that has already been answered doesn't need to be answered twice with the same answer - bring something new to the table.
- -ShadowOfTheFuture-
- Scratcher
1000+ posts
Custom c blocks and hat blocks
Just to clarify: you want to be able to make custom c-blocks, like this?
With custom stack blocks that we currently have, it's pretty easy to visualize how they work: a custom block's basically just a group of blocks, sometimes with custom inputs, that are put together to work as one unit, often used to save space or make scripts more modular. Proposed custom reporters (and booleans) would also be pretty easy to understand; they would return values that can afterwards be used wherever it needs to be used (stored in a variable, used in a calculation, etc.).
But how would a custom c-block work, and how would it be defined? I can't really think of an intuitive way off the top of my head. Moreover, as far as I know, similar things don't really appear in other programming languages, though that might well just be my ignorance when it comes to that field.
EDIT: I've given this some thought, and now I can conceivably imagine something like this:
But it still just doesn't really rub well with me; it feels clunky and nonintuitive. Not to mention that I still can't think of a parallel with other languages.
custom c-block () <>{
} :: custom
With custom stack blocks that we currently have, it's pretty easy to visualize how they work: a custom block's basically just a group of blocks, sometimes with custom inputs, that are put together to work as one unit, often used to save space or make scripts more modular. Proposed custom reporters (and booleans) would also be pretty easy to understand; they would return values that can afterwards be used wherever it needs to be used (stored in a variable, used in a calculation, etc.).
But how would a custom c-block work, and how would it be defined? I can't really think of an intuitive way off the top of my head. Moreover, as far as I know, similar things don't really appear in other programming languages, though that might well just be my ignorance when it comes to that field.
EDIT: I've given this some thought, and now I can conceivably imagine something like this:
define (move and if <condition :: custom> then {} :: stack)
move (10) steps
if <condition> then
more blocks here :: custom
end
But it still just doesn't really rub well with me; it feels clunky and nonintuitive. Not to mention that I still can't think of a parallel with other languages.
Last edited by -ShadowOfTheFuture- (Oct. 26, 2019 12:28:14)
<Insert uncreative signature here>
██ ██ ██ ██ ██ ██
██ ██ ██ ██ ██ ██
██ ██ ██ ██ ██ ██ ██
██ ██ ██ ██ ██ ██ ██
███ ███ ██ ████ ██ ███ ███
█████████ █████ █████ █████████
“Though the seasons come and go, and sunshine turns to snow, we will always have tomorrow up ahead.”
- WindOctahedron
- Scratcher
1000+ posts
Custom c blocks and hat blocks
A custom c-block is a group of blocks with custom inputs in forms of code, not just booleans and reporters (they can be there, too, but they are optional). There can be more than one different code inputs in one block.custom c-block () <>{
} :: custom
But how would a custom c-block work, and how would it be defined? I can't really think of an intuitive way off the top of my head.
That's how I can explain them.
Not to mention that I still can't think of a parallel with other languages.Can you please clarify what you mean?
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.
- -ShadowOfTheFuture-
- Scratcher
1000+ posts
Custom c blocks and hat blocks
A custom c-block is a group of blocks with custom inputs in forms of code, not just booleans and reporters (they can be there, too, but they are optional). There can be more than one different code inputs in one block.
That's how I can explain them.
So something like this?
define (custom c-block (num :: #5525bb) <bool :: #5525bb> {block custom input :: #5525bb} :: stack custom)
move (num :: #5525bb) steps
if <bool :: #5525bb> then
block custom input :: #5525bb
Can you please clarify what you mean?Other programming languages have functions (custom blocks) that can return values (custom reporters), but I've never seen anything similar to a custom c-block in another programming language. This may be due to my own ignorance, though.
Maybe something that uses eval() or exec(), but… who uses those?
Last edited by -ShadowOfTheFuture- (Oct. 26, 2019 15:11:14)
<Insert uncreative signature here>
██ ██ ██ ██ ██ ██
██ ██ ██ ██ ██ ██
██ ██ ██ ██ ██ ██ ██
██ ██ ██ ██ ██ ██ ██
███ ███ ██ ████ ██ ███ ███
█████████ █████ █████ █████████
“Though the seasons come and go, and sunshine turns to snow, we will always have tomorrow up ahead.”
- WindOctahedron
- Scratcher
1000+ posts
Custom c blocks and hat blocks
Yes.A custom c-block is a group of blocks with custom inputs in forms of code, not just booleans and reporters (they can be there, too, but they are optional). There can be more than one different code inputs in one block.
That's how I can explain them.
So something like this?define (custom c-block (num :: #5525bb) <bool :: #5525bb> {block custom input :: #5525bb} :: stack custom)
move (num :: #5525bb) steps
if <bool :: #5525bb> then
block custom input :: #5525bb
Oh, you meant programming languages!Other programming languages have functions (custom blocks) that can return values (custom reporters), but I've never seen anything similar to a custom c-block in another programming language. This may be due to my own ignorance, though. Can you please clarify what you mean?
Well… every program (including any c-blocks) must eventually be compiled into machine code to make it executable. This means that every non-custom c-block has been programmed like a custom one in machine code.
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.
- CatsUnited
- Scratcher
1000+ posts
Custom c blocks and hat blocks
I was going to write up a much longer post but then it made no sense and this topic is a duplicate anyway so: …
Other programming languages have functions (custom blocks) that can return values (custom reporters), but I've never seen anything similar to a custom c-block in another programming language. This may be due to my own ignorance, though.
Maybe something that uses eval() or exec(), but… who uses those?
To answer your question, in other programming languages, you are not limited to just returning something like a number or a string of text. You can return any data type, including more code, so something like:
return functionName();
bottom text
- -ShadowOfTheFuture-
- Scratcher
1000+ posts
Custom c blocks and hat blocks
Okay, thanks for the clarification. To answer your question, in other programming languages, you are not limited to just returning something like a number or a string of text. You can return any data type, including more code, so something like:You can also make variables equal functions or objects in JS and other programming languages. I think the main problem with implementing something like custom C blocks is that thinking about it in the scope of Scratch is complicated and is probably an indicator that this is something that shouldn't be added.return functionName();
<Insert uncreative signature here>
██ ██ ██ ██ ██ ██
██ ██ ██ ██ ██ ██
██ ██ ██ ██ ██ ██ ██
██ ██ ██ ██ ██ ██ ██
███ ███ ██ ████ ██ ███ ███
█████████ █████ █████ █████████
“Though the seasons come and go, and sunshine turns to snow, we will always have tomorrow up ahead.”
- WindOctahedron
- Scratcher
1000+ posts
Custom c blocks and hat blocks
I've discussed something about the possibility of implementing the suggestion, but I haven't explained yet why was I even trying (supporting).
I support this suggestion, because I tried to simulate a programming language using Scratch (I can't say the language's name, because it contains profanity), but it was too hard. It's because there was a function that had some code input, which is hard to workaround. However, if custom c-blocks are ever added, I will be able to simulate the language.
I support this suggestion, because I tried to simulate a programming language using Scratch (I can't say the language's name, because it contains profanity), but it was too hard. It's because there was a function that had some code input, which is hard to workaround. However, if custom c-blocks are ever added, I will be able to simulate the language.
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.
- Gold_Creator
- Scratcher
80 posts
Custom c blocks and hat blocks
define custom block
insert script you want here
|
'
/
,
|
when green flag clicked
forever
reset timer
end
when [timer v] > (0)
insert custom block here
or
when green flag clicked
forever
if <insert boolean here> then
insert custom block here
end
end
Last edited by Gold_Creator (April 21, 2020 20:46:44)
evil kumqua-
YUM, kumquats are delicious
- space_elephant
- Scratcher
500+ posts
Custom c blocks and hat blocks
As of 3.0, there is no c-block or e-block. Instead of
for the if else block, scratch 3.0 uses a much better system: A c-mouth is an input, just like a number input. It returns an argument that is a stack block, and is unevaluated. This means
This allows any number of c-mouthes, and any inputs or text between or after c-mouthes. The suggestion should be updated to include all of these.
c if %b then // if
e if %b then // ifelse (else is hardcoded)
k forever // forever. k means c but cap and loop
if %b then %c // if
if %b then %c else %c // ifelse
forever %c %l // forever. %l means loop
- Maximouse
- Scratcher
1000+ posts
Custom c blocks and hat blocks
I agree. Maybe there could be an “Add an input: c-mouth” option in the “Make a Block” dialog: As of 3.0, there is no c-block or e-block. Instead offor the if else block, scratch 3.0 uses a much better system: A c-mouth is an input, just like a number input. It returns an argument that is a stack block, and is unevaluated. This meansc if %b then // if
e if %b then // ifelse (else is hardcoded)
k forever // forever. k means c but cap and loopThis allows any number of c-mouthes, and any inputs or text between or after c-mouthes. The suggestion should be updated to include all of these.if %b then %c // if
if %b then %c else %c // ifelse
forever %c %l // forever. %l means loop
(sorry, I can't make a better mockup)
- Discussion Forums
- » Suggestions
- » Custom c blocks and hat blocks