Discuss Scratch

DadOfMrLog
Scratcher
1000+ posts

Renaming local sprite variable also changes name where used in other sprite scripts

Haven't noticed any mention of this anywhere else, but I got bitten by this rather badly, and thought I'd better bring it up here…

If you have a local variable in some sprite, and other sprites also have a local by the same name, then changing the name in the first sprite will change all uses of local variables of the same name within the scripts of other sprites (“set” & “change” blocks, and anywhere it's used in expressions, etc.).

In fact, if you rename to a variable name that another sprite already has, you can really mess up your project quite badly. It can lead to some pretty nasty problems that take considerable time to sort out…

Local variables in scripts of other sprites shouldn't change when renaming, only global vars should change everywhere.
(Hoping it's not too hard to fix this…)

Last edited by DadOfMrLog (May 21, 2013 11:54:36)



Alternate account: TheLogFather –– HowTos and useful custom blocks (see studio). Examples below…


- String manipulation - - - X to power of Y - - - Clone point to clone - Detect New Scratcher - Speed tests studio -

Powered by DjangoBB