Discuss Scratch

theonlygusti
Scratcher
1000+ posts

Best block idea! Organise code [CODE SECTIONS]

I would love to have the ability to sanction my code into different sections. This would make it so much easier to use, edit and debug my projects, and I'm sure others will feel the same way.

It would be brilliant if we could see a c-block that allows us to add this function, my concept looks like:

[name-of-section] ▼:: grey 

[name-of-section] ▲ {

} :: grey

The arrows let your code become collapsible chunks, so that extremely large scripts can suddenly become much easier to manage. You can use the text area to name your section whatever you want.

Also, these blocks shouldn't be in the block palette, as that might confuse new scratchers. I suggest distinguishing them from current blocks, maybe by rounding corners entirely, and having the as a right click option, like comments.

It would make projects so much nicer and easier to organise, which in turn makes projects easier to learn from.
Learning from other projects is one of the key concepts of Scratch!
This block will make that easier to accomplish.

You could turn a mess of stuff into something nice to view and debug,

when green flag clicked
[setup] ▲ {
set [xv v] to [0]
set [yv v] to [0]
goto x: (0) y: (-100) ::motion
show
} :: grey
[gameplay] ▼:: grey
[gameover] ▲ {
play sound [deathnoise v] until done
} :: grey

As they contain collapsible sections, the above, by clicking on the arrow, could become:

when green flag clicked
[setup] ▲ {
set [xv v] to [0]
set [yv v] to [0]
goto x: (0) y: (-100) ::motion
show
} :: grey
[gameplay] ▲ {
repeat until <gameover ::operators boolean>
if <key [a v] pressed?> then
change [xv v] by [-1]
end
if <key [d v] pressed?> then
change [xv v] by [1]
end
if <key [w v] pressed?> then
change [yv v] by [1]
end
end
} :: grey
[gameover] ▼:: grey

Please let me know what you think of my idea. If you want to include the custom blocks in your post then, using scratch blocks plugin, it looks like

[comment] ▼ :: grey
[comment] ▼ :: grey

and

[comment] ▲ {

} :: grey
[comment] ▲ {

} :: grey

Last edited by theonlygusti (Aug. 31, 2016 21:00:27)

GyroscopeBill
Scratcher
500+ posts

Best block idea! Organise code [CODE SECTIONS]

It's cool. It's a lot neater than the comments we have at the moment.
AonymousGuy
Scratcher
1000+ posts

Best block idea! Organise code [CODE SECTIONS]

Those aren't really comments…
theonlygusti
Scratcher
1000+ posts

Best block idea! Organise code [CODE SECTIONS]

AonymousGuy wrote:

Those aren't really comments…
I know, I will re-title it if you can think of a name, it's just that this is the one I came up with.
djdolphin
Scratcher
1000+ posts

Best block idea! Organise code [CODE SECTIONS]

Can't you just use comments to label the sections?
AonymousGuy
Scratcher
1000+ posts

Best block idea! Organise code [CODE SECTIONS]

There is technically a workaround (put all the scripts in custom blocks) but I still think it would be useful.

Support.
Blueinkproductions
Scratcher
1000+ posts

Best block idea! Organise code [CODE SECTIONS]

AonymousGuy wrote:

There is technically a workaround (put all the scripts in custom blocks) but I still think it would be useful.

Support.
Technically
Anyway, support.
Firedrake969
Scratcher
1000+ posts

Best block idea! Organise code [CODE SECTIONS]

Technically a workaround, yeah, but I support.

(I think this is the first time I've supported a workaroundable thing )
turkey3
Scratcher
1000+ posts

Best block idea! Organise code [CODE SECTIONS]

I support, because attached comments can get messy. And the drop-downs can make code very clean,

Last edited by turkey3 (July 29, 2014 23:56:31)

theonlygusti
Scratcher
1000+ posts

Best block idea! Organise code [CODE SECTIONS]

Some of you have said how there is technically a work-around, although there might be, it would still leave projects quite messy with all the
define section
just lying around.
epicsandwich123
Scratcher
100+ posts

Best block idea! Organise code [CODE SECTIONS]

support
theonlygusti
Scratcher
1000+ posts

Best block idea! Organise code [CODE SECTIONS]

djdolphin wrote:

Can't you just use comments to label the sections?
Yes, but current Scratch comments are the ugliest things. This block would make everything neater. Even just a comment block would make everything neater.
Blaze349
Scratcher
1000+ posts

Best block idea! Organise code [CODE SECTIONS]

turkey3 wrote:

I support, because attached comments can get messy. And the drop-downs can make code very clean,
Thepuzzlegame
Scratcher
1000+ posts

Best block idea! Organise code [CODE SECTIONS]

Support
djdolphin
Scratcher
1000+ posts

Best block idea! Organise code [CODE SECTIONS]

theonlygusti wrote:

djdolphin wrote:

Can't you just use comments to label the sections?
Yes, but current Scratch comments are the ugliest things. This block would make everything neater. Even just a comment block would make everything neater.
I'd prefer inline, multiline comments (like the old comment block) that could wrap around scripts, instead of a dedicated section block.
theonlygusti
Scratcher
1000+ posts

Best block idea! Organise code [CODE SECTIONS]

Yes, that was actually my first idea. I do like the idea of collapsible c-blocks though, we could just multi-line the title section so that it can be used as a comment
theonlygusti
Scratcher
1000+ posts

Best block idea! Organise code [CODE SECTIONS]

How about also re-adding the old comment block? That is neater than the current comments (if it was added, I would actually start using comments):
These new blocks could maybe have their own palette, called comments or organise, or something like that. They could also appear under the More Blocks palette.
comment > :: grey

comment v :: grey
[multi-lineable area] :: grey

section: [title] :: grey cstart
superninja109
Scratcher
25 posts

Best block idea! Organise code [CODE SECTIONS]

support when I want to bugfix the game that I have a link to in my sig, It is like going through a jungle of scripts because some of the are even on top of each other.
Blueinkproductions
Scratcher
1000+ posts

Best block idea! Organise code [CODE SECTIONS]

superninja109 wrote:

support when I want to bugfix the game that I have a link to in my sig, It is like going through a jungle of scripts because some of the are even on top of each other.
Right-click->clean up can help.
PH-zero
Scratcher
100+ posts

Best block idea! Organise code [CODE SECTIONS]

Yes! Support!

Powered by DjangoBB