Snapblocks (Part 1)

I've been thinking about a way to allow readonly number dropdowns, and editable text dropdowns. My idea is to use a capital V for readonly, and a lowercase v for editable. It would look something like this.

switch to costume [costume V]
(split [hello world] by [ v])
(item (1 v) of @list)
(readonly number (1 V))

The filetype name defaults to some hex gibberish. :P

I was referring to how sometimes the forum shows the filename in the posts, but I guess it didn't here (it's very inconsistent when it allows you to click on the image, and see the original filename).

I assume it depends on the size of the image. You can select the image and quote it to see the image name, though.

Interesting. What about if the image can be imported to Snap! then you're able to get the blocks of it? (while kinda complicated but still kinda cool)

I think it might be only draggable when you drag and drop it in, and clickable when you use the upload button.
Drag&Drop:
cvsync
Upload Button:
rvsync
I admit defeat I don't know how it works

I finally added block wrapping support

snapblocks (19)

(I stole this script from Pocket size hyperoperator script)

Yeah, there are a few things that need to be fixed, but at least it works.

For devs

Block wrapping does need to be enabled as an option, where you specify the style

var docView = snapblocks.newView(doc, {
  style: "snap",
  scale: 1,
  wrap: true
});

The wrap size is also customizable

var docView = snapblocks.newView(doc, {
  style: "snap",
  scale: 1,
  wrap: true,
  wrapSize: 100
});

Oh yeah, I also added proper scratch 3 rings, mainly just to have them look better than what they were before.

snapblocks (18)

I finally added zebra coloring!

The only issue is that the colors aren't exact, but that's due to the fact that the svg color mix function is different from snap's color mix function. If I put the category colors in the code instead of in css, then maybe I could put snap's color mix function in. I guess that's another project I could work on.

For devs

This also has to be enabled

var docView = snapblocks.newView(doc, {
  style: "snap",
  scale: 1,
  zebraColoring: true
});

Yay!!

I've all along been wondering why anyone uses Snapblocks given that we have smart script pics, but zebra coloring is a tipping point; it's really starting to look like Snap!.

Maybe it could even include the XML for the smart script pics sometime, that would be Tipping Point: 2

Yes, although real smart script pics have the advantage that they include in the XML all the dependencies of the visible script. One made in Snapblocks wouldn't be runnable.

That is very true. Fortunately I can change the app name in the xml to make snap show a popup warning that the script was created in an external program, and may not be runnable.

As for embedding custom blocks, the only custom blocks that would be embedded would have to be defined in the same snapblocks script.

There is an old project based on Tim Radvan pull request@2017 to export scratchblocks from Snap IDE.

BTW,
Snapblocks are really obsolete for a Snap. They need dedicated adapters for every platform/transport (Discourse, Discord, HTML, email, text editor).
But it's your circus, these are your monkeys...

True, but I'd rather have something similar to scratchblocks, but for snap, as there was pretty much nothing before. I actually fully support smart script pics way more, and I prefer to use those over snapblocks.

As for the things in the list you mentioned, uh, HTML is what snapblocks is made with (it uses javascript to generate SVGs, aka, HTML), there is a discourse plugin being worked on, and I don't see much use for discord or email (scratchblocks doesn't even have a discord bot, so I'm not sure it would be useful). Text editor may be useful, but again, there's nothing like that for scratchblocks. I know you didn't mention this, but there is actually a mediawiki plugin that is already made (and I hope it works), it's a fork of the scratchblocks mediawiki plugin.

Alright, I finally got around to adding the plus sign formatting (and fixed control custom block prototype zebra coloring).

{test block} :: define+
{+ test + block +} :: define
{test block} :: define
{\+ test \+ block \+} :: define
{+ + + test + + + block + + +} :: define
{@+ test @+ block @+} :: define

snapblocks (24)

Amazing!

Oh by the way, I actually changed how menus are made. A lowecase v is an editable menu, whereas a capital V is a readonly menu.

[edit v] [readonly V] (2 v) (5 V)

snapblocks (25)

Cool! Does @+ mean the same as +?

It means that it's the dark + no matter what.

{@+ @+ test @+ @+} :: define
{\+ \+ test \+ \+} :: define
{+ + test + +} :: define

snapblocks (30)