Snapblocks (Part 1)

I also found something weird. I don't know if this is intended or not:

  1. If you type just \, I got:
    snapblocks
    I guess it should be nothing instead of an undefined.
  2. Snap has a robot icon:
    robot
    But it does nothing if I type @robot.

Yeah, I know. It's really just trying to set the text to the letter after the last letter in the full text. I kept it like that, because it's also like that in scratchblocks.

Yes, I know, there are many (many) icons that I have not added yet. Believe me, it takes a while to recreate them in svg.

You can't just use Unicode? You use text for other purposes.

The icons in snap do not use unocode, and different fonts would draw different things. I don't want to include a font with snapblocks, so I'd rather recreate the icons in svg than try and recreate them in a font.

I guess, but many of them do exist in Unicode. This feels to me like the perfect being the enemy of the good, or however that saying goes. But whatever, your project.

Note: If you want to use reporters in define blocks, do this.

{@+ \ block \  @+ \ prototype \ @+ :: reporter other} :: hat control

There's no need for the backslashes \, @+, :: hat control and the :: reporter. You just need this.

{(+ block + prototype +)} :: define

snapblocks (58)

The :: define lets snapblocks handle the custom block prototype formatting.

Extra note: you can make cursed stuff with this

I have seen this on the Snap! Wiki at least, can you make so snapblocks accept both ::list and ::lists when making list blocks? Because some people mistakenly type the wrong name and the blocks didn't turn out to be the intended colour.

This is just an old revision of a page, someone accidentally typed ::lists rather than ::list

Hey, that’s me! I didn’t know snapblocks and saw that this page was lacking, so I looked at other blocks and how they were created and went off that knowledge.

Yes, I do know.

Honestly, I actually thought about that, as I also second guess whether it's list or lists. Plus, it's a very simple edit for me to add lists, because I can do the same thing I did for grey and gray.

There, added (for 1.4.0), add lists · snap-blocks/snapblocks@0411e87 · GitHub

I found something weird again.

The Scratch define is now gray rather than purple, and:

define hello

snapblocks (1)

Is this intended?
Also:

if <>
say []
end

Nevermind, read the original post that's why this is happening

You mean red?

I think @ego-lay_atman-bay forgot to add support for that block or deprecated using end to close C-inputs. snapblocks is a fork of scratchblocks and Scratch names the if condition block "if <> then", but Snap! rather names it simply "if <>". It just doesn't recognise that block.emphasized text

Probably because Snap! doesn't have a dedicated colour for custom blocks. So the Other category acts as a fitting option for generic custom blocks.

Oh, I thought the red "define hello" was united with the other statement. snapblocks don't treat "define" to make custom blocks anymore, because define blocks simply don't have any extra label preceding the block itself.

snapblocks (1)

Snapblocks appear black when you try to post it in the forums. This only happens in SVG. What's going on is this a bug or a SVG restriction thing?

I tried using snapbacks in html but it didn't work

Yeah, I just deprecated using end because c-blocks are pretty inconsistent in scratchblocks.

if <> then
...
end
if <> then {
...
}

I decided all c-blocks should use curly braces, as I don't want to confuse new people with two different syntaxes for a c-block (like I was when I first learned scratchblocks).

No, the reason for the change, was because I think using curly braces is better.

define {hello}

And it fixes this

define ((block)) [] ({} @addInput)

scratchblocks:

]

snapblocks:
1000377433

Now, to create custom snap blocks, you just need to do this

{block} :: define+

1000377434

(btw, I'm actually thinking of just removing the need for :: define)

And then of course you can change the shape

(block) :: define+

1000377435

How did you do it?