Calling For Sprite variables from a seperate sprite

How would you call the sprite variable from a seperate sprite?

I tried using lists to have the sprite i want to call it from assemble it and user their own stuff, but it still pulls from the sprite this script is in ( i used the stage in this example) i want to be able to assign and edit properties(sprite variables) from a single sprite. Any idea how one would do this?

quickly made this block, hopefully it helps
untitled script pic (37)

how do i use the block? or download it. im quite new

You can drag script pics, like the one above, directly into the Snap! editor.

thats sick

It is indeed

it still has trouble setting the variable, is there a way to get around that too?

You don’t need to use metaprogramming

guess I should’ve thought of this first… both of them work fine though, so it’s op’s choice

Until you start wanting to set the variable to stuff like lists, costumes, or other objects. The metaprogramming way will throw an error, but passing the value in as just a regular input will work.

yeahhh just realized that.. op, disregard my solution to setting the variable

I will admit, the biggest downside to my solution is, if you try setting variable from a variable name used in the custom block, it won’t set it in the sprite, but instead in the block.

from a variable name used in the custom block

Do you mean, from a variable defined in the custom block? That’s to be expected, same as if you shadow the current sprite’s sprite variable in a block you’re using the block’s variable.

untitled script pic (76)

untitled script pic (77)

Maybe just trigger a broadcast to all
untitled script pic (78)
and processs
untitled script pic (79)

its also stupid laggy, sprite variable calling by stratosphere | Snap! Build Your Own Blocks

would i just need to manually sort through the sprites and create different forever loops for each of them?

You may set desired attributes of blocks for some sprite and drag them to another sprite/stage.

Or set this script as a sprite method and just call.


But broadcast/request seems to be the simplest way to go, without the whole bookkeeping, variable detection…