Forum post that I was going to put in: Hello! Today we will be talking about local and global scope in Scratch! [u]1. What is local and global scope?[/u] Alright, let me explain local scope with define blocks. You know you can type stuff in a custom block with an/multiple inputs, like this: [scratchblocks] custom block example ([87782727] :: custom) :: custom [/scratchblocks] This will be stored in the define block for this custom block "custom block example". It can be used for things like this: [scratchblocks] define custom block example [input name] if <(input name) = [87782727]> then say [Hi!] else say [Hello!] [/scratchblocks] By using the "custom block example" block at the top, the sprite will say "Hi!". But what if we use it in a normal script? [scratchblocks] when green flag clicked custom block example ([87782727] :: custom) :: custom wait [0] seconds if <(input name :: custom) = [87782727]> then say [Hi!] else say [Hello!] [/scratchblocks] In this case, scratch cat will say "Hi!" then "Hello". Why is this the case? Because input name is stored ONLY in the define block, not elsewhere (well, only as "0"). This is also why pulling out a define block variable on its own will always say "0". This is done to prevent crashes. [u]2. Now, what about clones?[/u] Clones is where stuff gets a lot tricker. Clone's data is only stored inside the clone. This is how Clone ID works, before a clone is created, change the variable by whatever (1, 7, 68), then create the clone. If done correctly (and coded to store changes), you can get multiple clones with multiple different data stored. You can see the clone ID changes globally, but what's stored in a clone does not. So, if not changed through when I start as a clone, the clone ID of that clone stays the same. This is very useful and saves block space. Now, let's go onto... [u]2.5. The Problems[/u] Now, here are the issues. Let's say you wanted to make an arcade game (on scratch). You are using the symbols, but to cut down on block code, you used clone ID. Now, you coded the rolling, with that done correctly by changing all of the sprites costumes. But you run into a problem. Only the non-cloned changes the list. This is because the cloned ones are storing it locally. You can use other methods that work, by using trial and error or using a tutorial. And now I'll explain why we need some local and global scope blocks for clones. [u]3. Why we should get local and global scope extensions.[/u] Alright, now here's why we should need this. First, this is in normal coding languages such as Python, which you can put global (variable name) to use and store it. We don't need this in scratch, but we need some why for clones to affect the global scope in some way, not forcefully on a local scope. I do not expect most young people to understand this. This is a technical topic, and should be only kept into extensions to stop confusing people about something you don't need much later on. I suggest Scratch should add an extension about this in 4.0. Thanks for reading this.
Please Scratch. Please tell me why I cannot post this without problems.