Place block in sprite

is it possible (without js) to have a block that places/deletes a block from another sprite or a block that can return the xml of a sprite. ex

<scriptsonly app="Snap! 10.3.6, https://snap.berkeley.edu" version="2"><script x="391" y="134.66666666666663"><block s="doDeclareVariables"><list><l>a</l></list></block><block s="doSetVar"><l></l><l>0</l></block><block s="doChangeVar"><l></l><l>1</l></block></script><script x="299" y="395.1666666666667"><block s="setHeading"><l>90</l></block><block s="setHeading"><l>90</l></block><block s="setXPosition"><l>0</l></block></script></scriptsonly>

Check out the SciSnap! "Install Eventhandler" blocks.

i couldnt find a sci snap block that does this. if you know the block lmk

so what you need to do is
when anything is edited,
see if there are any items in the data variable that are xml
extension syn_scripts (item (whatever) of data).

DO NOT use the scisnap block. very buggy and does not support deleting.

Actually, in my experience, the extension syn_scripts has the exact same problems and replaces any existing scripts in the sprite, unlike the scisnap block which simply adds blocks/scripts.

im trying to whenever i rename all variables either update every script so that i can send the change through mqtt or get the xml and send it like that

can you give an example


Here is the example that comes with SciSnap.

Edit: AND, finally the block is actually working for me! Note that, with either the Scisnap block or the syn_scripts block, when it is broken, it can still load primitives, just not custom blocks (replaces them with "undefined!").

just
syn_scripts (item () of data)

create sprites, deleted clones, or permanent clones script pic (1)
???

what does this do

untitled script pic (12)


This will replace all the scripts in the selected sprite with the map block (just an example):

To select a different sprite, check out the "select sprite" block in SciSnap!

no i want to just add a block to the script

My best advice would be to begin by removing ALL the scripts in the sprite:
untitled script pic (15)
And then one by one adding the scripts you want using the SciSnap! install eventhandler block. Just iterate through a saved copy of "my [scripts V]"; excluding the one you want to add to, and then do something like this:


And load it in too. But keep in mind that there may be a way to use syn_scripts to load multiple scripts at once which I don't know about.

you don't need to-just get the new data of a sprite's scripts after being edited, then syn scripts it.

ya but what if the other person edits first

well if you have the same code for syncing scripts for each person, everything should work fine, right? can i have an example?

you have the example. the problem is when we are renaming all variables i want it to rename the variables in all the scripts across the mqtt

the script xml will change to the renamed one, then just syn scripts.