Discuss Scratch

ButWhyNot
New to Scratch
1 post

Scratch 2 extensions for Raspberry Pi

Hi,

I was hoping that I could develop some extensions to support some additional HATs, since Scratch 2 on the Raspberry Pi only supports the Sense HAT, plus some anemic GPIO support that isn't as featureful as the GPIO support that Scratch 1 had.

I read about Scratch extensions on the Scratch wiki, and decided that an HTTP extension would make the most sense for interfacing with hardware. I wrote a simple “Hello, World” HTTP extension to try it out, but I couldn't figure out how to load the `.s2e` file. (I tried the secret “Import Experimental Extension” menu option that appears when you hold down shift while clicking on the File menu, but when I gave it the name of my `.s2e` file, it didn't do anything.)

Then I found the FAQ on this forum, which says:

HTTP extensions could only be used in the offline editor and are no longer supported.

So then I need to write a Javascript extension, right? But then the very next sentence says:

JavaScript extensions can't be used in the offline editor, and are the current type of extension.

So then what kind of extension can be used with the offline editor? The Raspberry Pi Foundation wrote their Sense HAT extension somehow.

Then I found this guide to creating extensions on the Raspberry Pi. So, it looks like it is possible, but it seems that Scratch is fairly user-hostile with respect to extension writers, based on what the document says:

  • Can't paste the extension path into the text box.
  • No error messages if the extension isn't loaded successfully.
  • Scratch programs that use extensions are saved with a `.sbx` file extension, but the Load Project dialog only displays files with a `.sb2` file extension, so you have to rename your programs after you save them. (Though somehow the official Sense HAT extension doesn't have this problem.)

That last one seems especially insane!

So before I waste more time on this, I'm trying to figure out: Am I missing something here? Or is it really as crazy as it seems? Is the Scratch 2 editor going to actively fight against me trying to extend it? Should I not bother?

Thanks for any information that will shed light on this situation!

P. S. Does this forum not have a “search” function? If I type stuff into the search box at the top, it just searches Scratch projects, not the forum.
itchy20
Scratcher
100+ posts

Scratch 2 extensions for Raspberry Pi

Take a look at https://mryslab.github.io/s2-pi/. Perhaps that might give you some ideas.

Powered by DjangoBB