Discuss Scratch

Nambaseking01
Scratcher
1000+ posts

Custom c blocks and hat blocks

SuperDoom wrote:

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?!
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
beastman56003
Scratcher
17 posts

Custom c blocks and hat blocks

No, Sorry
define nope
ThatOneWeirdDude
Scratcher
1000+ posts

Custom c blocks and hat blocks

beastman56003 wrote:

No, Sorry
define nope
What makes you the decision maker?


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:

forever

end
repeat until <>

end

Turn into this?:

forever :: custom blocks

end
repeat until <> :: custom blocks

end
Sorry if this is a silly question.


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

ThatOneWeirdDude wrote:

beastman56003 wrote:

No, Sorry
define nope
What makes you the decision maker?


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

EZ-Games wrote:

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:

forever

end
repeat until <>

end

Turn into this?:

forever :: custom blocks

end
repeat until <> :: custom blocks

end
Sorry if this is a silly question.
U R Rite

The best scratcher on earth. Lets get to #1 most followed BOI
EZ-Games
Scratcher
1000+ posts

Custom c blocks and hat blocks

munchcraft wrote:

-snip-
U R Rite
Alright.

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?

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

-ShadowOfTheFuture- wrote:

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.
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.
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

WindOctahedron wrote:

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

-ShadowOfTheFuture- wrote:

WindOctahedron wrote:

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
Yes.

-ShadowOfTheFuture- wrote:

WindOctahedron wrote:

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.
Oh, you meant programming languages!
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

-ShadowOfTheFuture- wrote:


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?
I was going to write up a much longer post but then it made no sense and this topic is a duplicate anyway so:
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();
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.

bottom text
-ShadowOfTheFuture-
Scratcher
1000+ posts

Custom c blocks and hat blocks

CatsUnited wrote:

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();
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.
Okay, thanks for the clarification.

<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.

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.
-Snipet-
Scratcher
500+ posts

Custom c blocks and hat blocks

Support

website =)
Blasted little 60 second rule…
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
c if %b then // if
e if %b then // ifelse (else is hardcoded)
k forever // forever. k means c but cap and loop
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
if %b then %c // if
if %b then %c else %c // ifelse
forever %c %l // forever. %l means loop
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.

red link
[url=redlink.com][color=red][u]red link[/u][/color][/url]
Maximouse
Scratcher
1000+ posts

Custom c blocks and hat blocks

space_elephant wrote:

As of 3.0, there is no c-block or e-block. Instead of
c if %b then // if
e if %b then // ifelse (else is hardcoded)
k forever // forever. k means c but cap and loop
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
if %b then %c // if
if %b then %c else %c // ifelse
forever %c %l // forever. %l means loop
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.
I agree. Maybe there could be an “Add an input: c-mouth” option in the “Make a Block” dialog:

(sorry, I can't make a better mockup)


This is Maximouse's signature. Learn more about signatures.
Maximouse
Scratcher
1000+ posts

Custom c blocks and hat blocks

Bump


This is Maximouse's signature. Learn more about signatures.

Powered by DjangoBB