How does the scope of primitive var_declare work?

var_declare can declare variables. I am not sure how the scope works. I think the scope tells if the variable is for a single sprite or all sprites.

Yes. But... those blocks exist to support a library, in this case the "Create variables" library. Those blocks are both much more self-documenting and provided with help screens:


Using the gray PRIMITIVE blocks instead of the libraries is (imho) just showing off. There's no documentation on PRIMITIVE because we don't expect anyone to use it! ;~)

you can put global, script, or sprite. global and sprite have the same scope as if you just made a variable the normal way (make a variable button, type a name, check or leave unchecked 'for this sprite only', press ok...), script is like the script vars block.

and @bh

then why in the world make it available? i use it all the time and hardly ever load the library because often times what i want to do is just what the block is supposed to do, not load a bunch of premade blocks into my palette. besides, theres no reason to make a custom block that maps directly to another block and ultimately does exactly the same thing when im using said block in another custom block that will hide all this anyways

You know why: to support libraries with JS code by putting the code inside Snap! rather than in a JS Function block in the library. It's a security thing.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.