Discuss Scratch
- Discussion Forums
- » Suggestions
- » Custom C Blocks
- gosoccerboy5
-
Scratcher
1000+ posts
Custom C Blocks
You know how you can add script-local variables/booleans to custom blocks?
Well I was thinking, maybe you can add script local scripts to custom blocks!!
What happens is in the definition of the procedure you can drag the block out of the “define” block, then use it in the scripts. When actually using the custom block it'll show as a C-block, and the C is where you put your block inputs.
You can always drag it back out and edit it. This way you can use conditional statements easily in your custom block.
If you don't want to drag a whole script into the block just make a new custom block that goes in there. And if it feels messy I'm proposing that you should be able to collapse the C block!
This would be very versatile. Why? Well, this would be no ordinary custom block: you could make all sorts of things, like things that are requested often! You could build your own version of Snap! This would bring new meaning to the phrase BYOB. For example, you might need a way to immediately execute a script, so you make this script:
(Credit to @PkmnQ)
As you can see, you will drag a few blocks of code into the “warp” C block, and those pieces of code act like the “script” block in the block definition of “warp”.
PLEASE GIVE FEDBACK PLZZZZZZ
Sorry but I just want to make Scratch a better place
Well I was thinking, maybe you can add script local scripts to custom blocks!!
What happens is in the definition of the procedure you can drag the block out of the “define” block, then use it in the scripts. When actually using the custom block it'll show as a C-block, and the C is where you put your block inputs.
You can always drag it back out and edit it. This way you can use conditional statements easily in your custom block.
If you don't want to drag a whole script into the block just make a new custom block that goes in there. And if it feels messy I'm proposing that you should be able to collapse the C block!
This would be very versatile. Why? Well, this would be no ordinary custom block: you could make all sorts of things, like things that are requested often! You could build your own version of Snap! This would bring new meaning to the phrase BYOB. For example, you might need a way to immediately execute a script, so you make this script:
define warp (script :: stack)Now you've created a way to draw hexagons once you receive a certain message, and more.
script :: custom // this will run without screen refresh
when I receive [hexagon v]
warp {
repeat (6)
move (10) steps
turn (72) degrees :: motion
} // this runs exactly like the block in Snap! also called warp: it executes script immediately
(Credit to @PkmnQ)
As you can see, you will drag a few blocks of code into the “warp” C block, and those pieces of code act like the “script” block in the block definition of “warp”.
PLEASE GIVE FEDBACK PLZZZZZZ
Sorry but I just want to make Scratch a better placeLast edited by gosoccerboy5 (Oct. 30, 2020 13:59:35)
- gosoccerboy5
-
Scratcher
1000+ posts
Custom C Blocks
If this seems too ‘advanced’ for Scratch then try thinking about this.
Sorry, you have to wait 60 seconds between posts.
Sorry, you have to wait 60 seconds between posts.
- gosoccerboy5
-
Scratcher
1000+ posts
Custom C Blocks
Someone, please provide a mockup if you know what I'm talking about!
- MartianSoil
-
Scratcher
100+ posts
Custom C Blocks
I do not have an image hosting site, but here is a Mockup. (This is my first time making one, I know it is bad, I made in in the scratch editor)
EDIT: I know that you can do this with inspect element, but I am currently on an iPad
EDIT2: I don’t think that that was really what you were talking about
. I thought you meant stuff like allowing there to be local variables that only apply to the block.
EDIT: I know that you can do this with inspect element, but I am currently on an iPad
EDIT2: I don’t think that that was really what you were talking about
. I thought you meant stuff like allowing there to be local variables that only apply to the block.Last edited by MartianSoil (Oct. 15, 2020 18:56:08)
- gosoccerboy5
-
Scratcher
1000+ posts
Custom C Blocks
Read the whole thing before you say duplicate. This is different.
- gosoccerboy5
-
Scratcher
1000+ posts
Custom C Blocks
Aha!!! This is a good example of a mockup: the “all at once” block in this link.
- gosoccerboy5
-
Scratcher
1000+ posts
Custom C Blocks
Wait, I found an interesting possibility for a mockup!!!!! https://scratch.mit.edu/discuss/topic/449871/?page=1#post-4526592
How did they do that????
How did they do that????
- gosoccerboy5
-
Scratcher
1000+ posts
Custom C Blocks
This is an outdated post because it was a horrible block art concept/mockup
Last edited by gosoccerboy5 (Oct. 29, 2020 17:56:39)
- PkmnQ
-
Scratcher
1000+ posts
Custom C Blocks
Better mockup:
define while <boolean> (lambda :: stack)
repeat until <not <boolean>>
lambda :: custom-arg
end
when green flag clicked
set [i v] to [0]
while <(i) < [5] :: operators> {
change [i v] by (1)
}
- gosoccerboy5
-
Scratcher
1000+ posts
Custom C Blocks
Oh my gosh that works a lot better! Thanks, that's a great way to represent it, and I didn't think about it!!!
- gosoccerboy5
-
Scratcher
1000+ posts
Custom C Blocks
Oops I made a completely unhelpful post
Last edited by gosoccerboy5 (Oct. 23, 2020 15:12:18)
- gosoccerboy5
-
Scratcher
1000+ posts
Custom C Blocks
I just realized this could be used to make better comments
define group (script :: custom stack)Then you can add a comment next to the “group” C block. Then viewers will know what blocks you're trying to comment on.
script :: custom stack
When flag clicked
group {
say [Hello, world!] for (2) secs
- MartianSoil
-
Scratcher
100+ posts
Custom C Blocks
If only @AonymousGuy was still active in scratch. This would likely have been added to his suggestion.
Also, thank you for explaining more.
Also, thank you for explaining more.
Last edited by MartianSoil (Oct. 29, 2020 17:44:39)
- Discussion Forums
- » Suggestions
-
» Custom C Blocks