Paste on with any effect

In this project, i show you my new block : Paste on sprite with effect.

(At the time of publishing this message, I noticed that @joecooldoo did approximately the same block in April. I'm still posting!)

Very cute!

One little bug: If the pen is down when you use that block, it will leave a line between the sprite and the origin. For example, I put a PEN DOWN before the SAY [I WILL USE THIS BLOCK] near the beginning of the green flag script. When you call your block, the line appears. So, after saving the state of the sprite, do a PEN UP.

Speaking of saving state, at first I was wondering why you used those ugly sprite variables instead of using script variables, but I realized it's because you do the actual saving and restoring in (separate) subprocedures of your block.

That should be fixable with metaprogramming. I wrote this:

to use this way:

Paste on with effect script pic (3)

(and the RESTORE block doesn't have to delete the variables). But I can't get it to work. It seems to make the script variables, but I can't put values in them and I can't make watchers for them. I vaguely recall that there's some issue about script variables in the Variables library. But I'm frustrated that whenever I try to use metaprogramming, it fails. I'm sure that's because I'm doing something wrong, but if I can't understand how to do it, what hope do users have?

Anyway, if you or someone can make this work, that'd be awesome!

Corrected: Thank's

(save and restore)
Oh, there are 2 old blocks (1-2 years)... I didn't dive again into it.

What about someting like this (block var):
save_restore var script pic (1)

save_restore var script pic (2)

I like, they're cool and very useful, especially if we need to stamp to sprites by colour.

Yeah, that's not bad. I'm still frustrated that I couldn't get my way to work.

In a perfect world you'd be able to say

(but of course with a non-constant expression as the name).

But I guess the official right way to do this is with roll your own OOP variables:

And then to save you say
untitled script pic (3)
and to restore you say
untitled script pic (4)
But instead of a variable FOO you make a list with a zillion of these things and then you FOR EACH ITEM to save and restore everything.

EDIT: Or even simpler, combine the making with the saving:

untitled script pic - 2024-07-08T005554.499

With a visible stepping, I can set the variable watcher
Stage (72)

I'm trying to save the variables two callers up (SAVE _ AS _ called from SAVE ALL SPRITE PROPERTIES called from PASTE ON WITH EFFECTS, so that the eventual RESTORE can find them). Does that work for you?

I think, yes.
untitled script pic - 2024-07-08T021707.846

untitled script pic - 2024-07-08T025414.022

Huh. I wonder what I did wrong. I'll try again I guess...