Discuss Scratch

AnthonyD9
Scratcher
1 post

Access custom blocks from all sprites (global procedures)

I agree, it is too often that I use the same custom blocks across sprites. Sometimes there are smaller chunks of code which would just be easier to put in a function and use throughout the project. For example fading something on or off the screen with ghost effect is something very common and I often make it into one block to keep it concise. In general, global custom blocks across sprites would be a great addition to scratch!
Crispydogs101
Scratcher
1000+ posts

Access custom blocks from all sprites (global procedures)

Bump cause dupe.

Hey! Look at this DTA!
Hej! My username is @Crispydogs101. I like listening to music, playing games, and more!
Sarah and duck, Pete the cat, Pegboard nerds, Tokyo machine, FORZA FAN!! Be High contrast Blue Be rich
medians
Scratcher
1000+ posts

Access custom blocks from all sprites (global procedures)

AnthonyD9 wrote:

I agree, it is too often that I use the same custom blocks across sprites. Sometimes there are smaller chunks of code which would just be easier to put in a function and use throughout the project. For example fading something on or off the screen with ghost effect is something very common and I often make it into one block to keep it concise. In general, global custom blocks across sprites would be a great addition to scratch!
Or when you have to put a long script in many different sprites, which can especially clutter them (since right now you have to drag the scripts on top of each sprite you want to be able to use the blocks throughout the project (and the Stage potentially). That can be really annoying to do, especially since:

medians wrote:

Also, to workaround this, you can copy the scripts to each sprite, but that can be tedious to do, can clutter each sprite with code, and there's also that 3.0 bug where the sprites move around, making it difficult to do.

Last edited by medians (April 21, 2023 00:55:42)


NEW: Medians bamboozled by 3.0 (version 3.0): https://scratch.mit.edu/projects/979822351/
hi875230163394: You're similar to valve in that you both hate a certain number…
Scratch 0.x, 1.x, 2.x, 3.x and LogoBlocks Archives
Bamboozlement: https://scratch.mit.edu/studios/33739789
Fun_Cupcake_i81: https://scratch.mit.edu/projects/850535211/
Years on internet: 15 (soon 16)
medians: Oh god not this utc - 12 thing again..
Fun_Cupcake_i81: What, were you expecting not to see the utc - 12 thing again? THE UTC - 12 THIGN ALWAYS RETURNS. ALWAYS.
medians: I knew it would happen. I was the one who started it last year.
Fun_Cupcake_i81: Well then if you didn't want it back maybe you need to time travel to last year and fix that

Oh wait if you could time travel I think we all know exactly when you would go-
user1: That picture is from 2.0. Now he’s at my house and is my pet.
user2: But this is medians we're talking about, so “from 2.0” can mean the same thing as “from five seconds ago”.

Detect Scratch version here
My other accounts: @selfexplanatory @modesties @chaircard @fireflyhero @dividendyield @colloids @radians @skeuamorphism @dihectogon @anglebisector @aau- @EditBlockColors @AdamantOrb @MoongeistBeam @festively @Ampharos_ @ straightforwardness
i trolled redcat LOL





if you see this
{what method did you use::control hat
answer on profile ::motion
} ::operators
;
IronMutantOne
Scratcher
11 posts

Access custom blocks from all sprites (global procedures)

change [ support] by (1)

Is an orange called an orange because an orange is orange, or is orange called orange because oranges are orange?

Peter Piper picked a peck of pickled peppers. Did Peter Piper pick a peck of pickled peppers? If Peter Piper picked a peck of pickled peppers, where is the peck of peppers Peter Piper picked? Say that 999999999999 times fast.

IronMutantOne
Scratcher
11 posts

Access custom blocks from all sprites (global procedures)

change [ support] by (1)

Is an orange called an orange because an orange is orange, or is orange called orange because oranges are orange?

Peter Piper picked a peck of pickled peppers. Did Peter Piper pick a peck of pickled peppers? If Peter Piper picked a peck of pickled peppers, where is the peck of peppers Peter Piper picked? Say that 999999999999 times fast.

_Geography__
Scratcher
30 posts

Access custom blocks from all sprites (global procedures)

I like what you are saying because it only makes it for 1 sprite and I got 5 sprites where I had the same block but had to make changes.

This is my signature, and I chose it.
when green flag clicked
define [my signature]
clear
Programmiggen
Scratcher
4 posts

Access custom blocks from all sprites (global procedures)

Super support, but a workaround, drag that block in another sprite and it will automatically copy
set [support v] to [infinity]

Last edited by Programmiggen (April 22, 2023 04:05:19)

medians
Scratcher
1000+ posts

Access custom blocks from all sprites (global procedures)

Programmiggen wrote:

Super support, but a workaround, drag that block in another sprite and it will automatically copy
set [support v] to [infinity]
That could make for a lot of unnecessary code though, especially when the custom blocks are long or are short but need to be used in a lot of places. And there's also a bug where when you try to copy scripts to other sprites, then it tries scrolling a bunch or moving around a lot, which if I remember correctly, makes it really easy to accidentally keep adding them to the wrong sprite or the same sprite over and over again.

NEW: Medians bamboozled by 3.0 (version 3.0): https://scratch.mit.edu/projects/979822351/
hi875230163394: You're similar to valve in that you both hate a certain number…
Scratch 0.x, 1.x, 2.x, 3.x and LogoBlocks Archives
Bamboozlement: https://scratch.mit.edu/studios/33739789
Fun_Cupcake_i81: https://scratch.mit.edu/projects/850535211/
Years on internet: 15 (soon 16)
medians: Oh god not this utc - 12 thing again..
Fun_Cupcake_i81: What, were you expecting not to see the utc - 12 thing again? THE UTC - 12 THIGN ALWAYS RETURNS. ALWAYS.
medians: I knew it would happen. I was the one who started it last year.
Fun_Cupcake_i81: Well then if you didn't want it back maybe you need to time travel to last year and fix that

Oh wait if you could time travel I think we all know exactly when you would go-
user1: That picture is from 2.0. Now he’s at my house and is my pet.
user2: But this is medians we're talking about, so “from 2.0” can mean the same thing as “from five seconds ago”.

Detect Scratch version here
My other accounts: @selfexplanatory @modesties @chaircard @fireflyhero @dividendyield @colloids @radians @skeuamorphism @dihectogon @anglebisector @aau- @EditBlockColors @AdamantOrb @MoongeistBeam @festively @Ampharos_ @ straightforwardness
i trolled redcat LOL





if you see this
{what method did you use::control hat
answer on profile ::motion
} ::operators
;
medians
Scratcher
1000+ posts

Access custom blocks from all sprites (global procedures)

Bringing this topic up

NEW: Medians bamboozled by 3.0 (version 3.0): https://scratch.mit.edu/projects/979822351/
hi875230163394: You're similar to valve in that you both hate a certain number…
Scratch 0.x, 1.x, 2.x, 3.x and LogoBlocks Archives
Bamboozlement: https://scratch.mit.edu/studios/33739789
Fun_Cupcake_i81: https://scratch.mit.edu/projects/850535211/
Years on internet: 15 (soon 16)
medians: Oh god not this utc - 12 thing again..
Fun_Cupcake_i81: What, were you expecting not to see the utc - 12 thing again? THE UTC - 12 THIGN ALWAYS RETURNS. ALWAYS.
medians: I knew it would happen. I was the one who started it last year.
Fun_Cupcake_i81: Well then if you didn't want it back maybe you need to time travel to last year and fix that

Oh wait if you could time travel I think we all know exactly when you would go-
user1: That picture is from 2.0. Now he’s at my house and is my pet.
user2: But this is medians we're talking about, so “from 2.0” can mean the same thing as “from five seconds ago”.

Detect Scratch version here
My other accounts: @selfexplanatory @modesties @chaircard @fireflyhero @dividendyield @colloids @radians @skeuamorphism @dihectogon @anglebisector @aau- @EditBlockColors @AdamantOrb @MoongeistBeam @festively @Ampharos_ @ straightforwardness
i trolled redcat LOL





if you see this
{what method did you use::control hat
answer on profile ::motion
} ::operators
;
PaperMarioFan2022
Scratcher
1000+ posts

Access custom blocks from all sprites (global procedures)

Support! This needs to be implemented because +1 You can't use this in other sprites.

Hello! Welcome to my signature!

I am a real Mario enthusiast and a fan of the franchise and also getting into the field of IT. I also play Luigi's Mansion and other games too!

Profile | Ocular | ScratchStats | PostPercent | GitHub Main | Snap!

Professional Mario Enthusiast / (NEW!) 3DS FC: 2252-0951-8546 / (NEW!) Switch FC: SW-2091-2478-9614 / (removed - due to concerns in moderation) ARarePaper



I forgor my account password to give an internet ☠

I’ve been a Scratcher since 2021!



My glorious meme section (scroll down to see more)






























Gamer_Logan819
Scratcher
1000+ posts

Access custom blocks from all sprites (global procedures)

Why is this NOT ADDED YET??

The forum boogeymen are out to get you

medians
Scratcher
1000+ posts

Access custom blocks from all sprites (global procedures)

Bringing this topic up.

PkmnQ wrote:

How would these work with local variables?


Actually, now that I think about it, having it change per sprite might lead to some interesting things.
Actually, in 2.0 it would just create a new local variable/list if the variable/list in the data block didn't exist before running it, but in 3.0 I'm pretty sure it just does nothing.

NEW: Medians bamboozled by 3.0 (version 3.0): https://scratch.mit.edu/projects/979822351/
hi875230163394: You're similar to valve in that you both hate a certain number…
Scratch 0.x, 1.x, 2.x, 3.x and LogoBlocks Archives
Bamboozlement: https://scratch.mit.edu/studios/33739789
Fun_Cupcake_i81: https://scratch.mit.edu/projects/850535211/
Years on internet: 15 (soon 16)
medians: Oh god not this utc - 12 thing again..
Fun_Cupcake_i81: What, were you expecting not to see the utc - 12 thing again? THE UTC - 12 THIGN ALWAYS RETURNS. ALWAYS.
medians: I knew it would happen. I was the one who started it last year.
Fun_Cupcake_i81: Well then if you didn't want it back maybe you need to time travel to last year and fix that

Oh wait if you could time travel I think we all know exactly when you would go-
user1: That picture is from 2.0. Now he’s at my house and is my pet.
user2: But this is medians we're talking about, so “from 2.0” can mean the same thing as “from five seconds ago”.

Detect Scratch version here
My other accounts: @selfexplanatory @modesties @chaircard @fireflyhero @dividendyield @colloids @radians @skeuamorphism @dihectogon @anglebisector @aau- @EditBlockColors @AdamantOrb @MoongeistBeam @festively @Ampharos_ @ straightforwardness
i trolled redcat LOL





if you see this
{what method did you use::control hat
answer on profile ::motion
} ::operators
;
horizontal_shading
Scratcher
1000+ posts

Access custom blocks from all sprites (global procedures)

I want this to be implemented

We have to stop climate change before it's too late. Help us spread the word to big companies. Also, ignore every post of mine posted before the year 2023. Those posts are cringe and outdated. I hate seeing them.

;
Umhead22
Scratcher
100+ posts

Access custom blocks from all sprites (global procedures)

I suport!

Wow. someone called me Um in my head,
VHS scratch

eat the pizza.
My birthday is 21 Mars
Stoutscientist
Scratcher
38 posts

Access custom blocks from all sprites (global procedures)

Support lol this is taking way too long the original post is from a decade ago
adimadiraju
Scratcher
48 posts

Access custom blocks from all sprites (global procedures)

Support x (28305664^ x 7327530e384293473.844853 +93042048245 x (449596430^) x 45367892246748 + 37924624347^) + 1

when green flag clicked
say (i hope I'm not late to the party!)
wait (5) secs
hey where did (everyone go v)
DID THEY ABANDON ME?
bruh there a wall here

say [AM WALL]
say [AM WALL]
say [AM WALL]
say [AM WALL]
say [AM WALL]
say [AM WALL]
say [AM WALL]
say [AM CHESSE]
say [AM WALL]
say [AM WALL]
say [AM WALL]
say [AM WALL]
say [AM WALL]

when green flag clicked
wait until <someone unfollows me>
unleash a horde of [evil kumquats]
say [GO HERE: https://www.youtube.com/@adityasworldofficial]
create clone of [this script v]

when I start as a clone
create clone of [backdrop v]
delete this clone

I'M <CRAZY :: sensing stack> BOI :: pen
round{
} round{
} ::operators
stop [all v] :: hat
when gf clicked :: cap
Scratch-Bytes
Scratcher
11 posts

Access custom blocks from all sprites (global procedures)

The issue with naming confusion with global blocks is sort-of valid, but there is already exactly this problem with variables, so the argument is disingenuous.

Personally I think a good practice is to name globals in caps, and locals as lower-case, but this should be fixed in the same way that it is fixed when you ‘display’ a variable: local names are always prefixed with the sprite name, as in ‘Sprite1:my-variable’, globals with global: as in ‘global:my-variable’.

What really hurts with blocks having to be copy-pasted though, is that copy-paste can't *replace* blocks. Say I create a block, then copy-paste it to a few other sprites. Then I update the original. When I then copy-paste it to the other sprites, it creates it in them as a completely new block, but with the same name. You have to go through your code changing all the block calls to the new block before you can delete the old one.

Honestly, at this point, any argument about keeping names clear is a bit laughable.

Blocks should be sharable, the name of the block would be automatically prefixed with ‘global:’ or ‘sprite-name:’, and the global blocks would also show in each sprite, just as global variables are visible in each sprite.

Last edited by Scratch-Bytes (Sept. 27, 2023 02:46:45)

TroyMac1ure
Scratcher
8 posts

Access custom blocks from all sprites (global procedures)

This will never be implemented. It has been asked for for a very long time. Excuses on how it will get confusing to new programmers, but I'm an experienced one and playing with some code that was using clones got me lost a few times. Honestly, this would be way less confusing than clone stuff. How it should be implemented has also been discussed many times and there have been very good ideas put forward. I love the idea of scratch and my kids use it all the time to create some cool things and share with their friends, but they ask me for help and I often find myself saying, “That's not going to be easy to do in scratch because they don't let you do this or that”, many times relating to something that would be easy with shared functions.
If not for the sharing of code and community of scratch, I would have forced them to move on a while ago so they can grow. I feel like not adding this option is stifling their ability to progress and learn good coding skills at the same time.
-effortIess-
Scratcher
100+ posts

Access custom blocks from all sprites (global procedures)

… ten years later, support. But why is it not rejected, or better yet, implemented?


Support the suggestion HERE by adding this button to your signature

BAN PI DAY!!! (joke)

100th post
TheRailwayNoob87
Scratcher
100+ posts

Access custom blocks from all sprites (global procedures)

Agree! Imagine if there were no global variables… That’s really annoying!!! The same applies to custom blocks, I mean, of course it does!

It could look like this:

define Custom Block
global () :: custom // supposed to be same next to the definition hat block

Or alternatively (I prefer the first one though):

// Sprite 1
define Block (argument)


// Sprite 2
when green flag clicked

[Block v] from [Sprite 1 v] (parameter) :: sensing

Always wanted to get experience at animating, voice acting etc.? Well then, tColc is just the right place to start with!
Our website: https://tcolc.w3spaces.com
On Scratch: https://scratch.mit.edu/studios/31874914/
For questions, please contact me on my profile!

Powered by DjangoBB