New version of my custom block "button costume from text"

My block "button costume from text" has been updated to version 1.1.
image
image

project

new improvements:

  • A color picker can be used to change the background and text colors directly on the block.
  • The pivot is now in the sprite's center.

@bh : It would be fantastic if this sprite could be imported into another project. You require a button; add it to your program! Unfortunately, the export function lacks a "for all sprite" block, which is currently used in this sprite. When we import this sprite into another project, we end up with undefined blocks. Very disappointing...it's hard to reuse code easily.

This does not need to be rewritten if i import a sprite:
image

Yeah, we know. Someday.

Export the blocks.
Snap! XML needs the block to already exist in the project or else it will be undefined.

If I were to import this into my game, it wouldn't work because there is no custom block named "log",
So I would have to export the blocks first.
<custom-block s="log %mlt"><l>Restarting the virtual drive in 2...</l></custom-block>

That's a very great idea! Thank you for sharing!

It would be really nice if you shared the project with the block though.

project

Just use this:

Screenshot 2022-02-02 3.15.30 PM

FInally I understand what the original reason was to export a sprite rather than a library (that's the plural of "block" :~) ). But the trouble with the sprite solution, apart from the missing block, is that with this solution you can only make one button. Really the BUTTON COSTUME block should create a sprite... although I guess it could clone the sprite if it specified to share the scripting area.

So, EXPORT SPRITE should export the transitive closure of its blocks. Dunno if Jens will be convinced, but I am. :~)

Didn't Jens say something about a backpack a while ago?

We could move anything from one project to another using a sprite as a "container."

Perhaps that is the key...

The undefined blocks are the missing link.

Jens presented the new features "my blocks," "split by blocks," and "definition of blocks" in a video: He was able to figure out which block was utilised by which sprite (I believe...) We're not far from achieving our objective...

Try to import this sprite

<sprites app="Snap! 7, https://snap.berkeley.edu" version="2"><sprite name="Sprite" idx="0" x="0" y="0" heading="90" scale="1" volume="100" pan="0" rotation="1" draggable="true" costume="0" color="80,80,80,1" pen="tip" id="2"><costumes><list struct="atomic" id="3"></list></costumes><sounds><list struct="atomic" id="4"></list></sounds><blocks></blocks><variables></variables><scripts><script x="63" y="45.833333333332575"><custom-block s="for %upvar = %n step %n to %n %cs"><l>i</l><l>2</l><l>2</l><l>10</l><script><block s="doSayFor"><block var="i"/><l>.5</l></block></script></custom-block></script></scripts></sprite></sprites>

This is what you got:
image

->This block com from a snap library and it is not reconize by snap !

this is the block:
image

That's the point...

Which one? Thanks.

^^^^^^^^^^^^^^^^^^^^^^^^^^

I'm sorry, I meant, which library?

îteration,composition

any block from any library gives this result if the library has not been previously loaded into the project before importing a sprite...

I get it. Okay, thanks. So it's not an error in the library, it's that the library isn't sprite-local so doesn't get exported with the sprite. (I thought you meant that some other library used that block without importing it.) Sigh, I'm doubtful about convincing Jens, but we'll see.

If you manage to convince Jens, I won't make any request for improvement for the next year (maybe :slight_smile: )

Nah, we both love to hear requests from actual users! ("Hear" is different from "approve," of course.)

what does the "code of" block mean?

If you're talking about this block
image
Then it returns the codification of that block.

If you're talking about this one
image
Then that returns the definition of a custom block.