NoMod-Programming

Jonathan50 wrote:

NoMod-Programming wrote:

They use different size pointers or something like that
…Yes, but the Smalltalk code shouldn't care. I'm pretty sure images are supposed to be portable
I'm sure they are supposed to be portable, but this says that they require a different VM

Jonathan50

Aw, ok.

Wettining

hehehe, you can zoom up to x1000 whereas it used to be limited to x400 or x500

infinitytec

Windows instructions are up! If you have a Mac or Linux: can you please get me instructions.
Also, the Raspberry Pi instructions may be out of date. Can someone check?

Jonathan50

You can make a Whiskers shortcut on your desktop.

Edit: I'll post exactly what I did.

infinitytec

Jonathan50 wrote:

You can make a Whiskers shortcut on your desktop.

Edit: I'll post exactly what I did.
I think the installer can do that.

Jonathan50

Here's exactly how to do it:
  1. Right click on desktop, go new, shortcut.
  2. Click browse and find Squeak.exe, hit OK and Next
  3. Replace “Squeak” with “Whiskers” and hit Finish
  4. Move the shortcut somewhere nice
  5. Right click on it and hit Properties
  6. You should be in the Shortcut tab, else just click on it
  7. Click in the Target field and scroll to the end. Put a space, and then copy and paste the file path of Whiskers.image
  8. Hit OK and you're done
Edit:

infinitytec wrote:

I think the installer can do that.
That's great
Edit 2: I tried the installer, it definitely works well

Jonathan50

@infinitytec: Can you please add
font-family: monospace;
to the CSS rule for the code blocks? Also here are instructions for macOS:

Download the Whiskers image file, and download the Squeak VM for macOS from squeak.org and unzip it. If you like you can rename the app to Whiskers and drag it into your Applications folder.

Now right click on the app and select the option “Show Package Contents” and double click Contents and Resources. Look through the files and find the default image file. The name starts with “Squeak”, then the Squeak version number and “-32bit”.

Click on it, and then click again, to select the file's name. Copy the name and then you can click out of it. Now go back to the Whiskers image file and rename it to be called the same as the image file you found earlier.

Now drag the Whiskers image file into the Resources folder. You'll be asked what you want to do with the old one, and hit “Replace”.

Whiskers should now be properly set up. You should be able to double-click on the app to open Whiskers.

Blaze349

Is this open source? If so can you add the link to the OP.

NoMod-Programming

Blaze349 wrote:

Is this open source? If so can you add the link to the OP.
Whoops. I'll do that right now!

Jonathan50

Do you plan to make the menus look like Scratch 2.0 again?

NoMod-Programming

Jonathan50 wrote:

Do you plan to make the menus look like Scratch 2.0 again?
I'll add that to my to-do list, but my old method for drawing it was very buggy and slow, so I'll have to redo it again.

infinitytec

Jonathan50 wrote:

@infinitytec: Can you please add
font-family: monospace;
to the CSS rule for the code blocks? Also here are instructions for macOS:

Download the Whiskers image file, and download the Squeak VM for macOS from squeak.org and unzip it. If you like you can rename the app to Whiskers and drag it into your Applications folder.

Now right click on the app and select the option “Show Package Contents” and double click Contents and Resources. Look through the files and find the default image file. The name starts with “Squeak”, then the Squeak version number and “-32bit”.

Click on it, and then click again, to select the file's name. Copy the name and then you can click out of it. Now go back to the Whiskers image file and rename it to be called the same as the image file you found earlier.

Now drag the Whiskers image file into the Resources folder. You'll be asked what you want to do with the old one, and hit “Replace”.

Whiskers should now be properly set up. You should be able to double-click on the app to open Whiskers.
Thanks. I'll finish making this look nice tomorrow!
Monospace is a good idea!

eribetra

when backdrop switches to .backdrop[ v] :: hat events
There is an unnecessary period in this block.

NoMod-Programming

Before I leave for the next week, does anybody know where I can find the source for the Pi GPIO extension for Scratch 2 from the raspberry pi? I want to see if I there's a solution that can allow Whiskers to load some extensions made for Scratch 2, but I need to check the source.

SimpleScratch

its in /usr/lib/scratch2/scratch_extensions/piGPIOExtension.js
new (function() {
var ext = this;
var fs = require('fs');

// Cleanup function when the extension is unloaded
ext._shutdown = function ()
{
for (pin = 2; pin < 28; pin++)
{
if (fs.existsSync("/sys/class/gpio/gpio" + pin))
fs.writeFileSync("/sys/class/gpio/unexport", pin, "utf8");
}
};

// Status reporting code
// Use this to report missing hardware, plugin or unsupported browser
ext._getStatus = function ()
{
return {status: 2, msg: 'Ready'};
};

ext.set_gpio = function (pin, val)
{
if (pin === '' || pin < 0 || pin > 27) return;

var dir = 0, lev;
if (val == 'output high') lev = 1;
else if (val == 'output low') lev = 0;
else dir = 1;

// check the pin is exported
if (!fs.existsSync("/sys/class/gpio/gpio" + pin))
fs.writeFileSync("/sys/class/gpio/export", pin, "utf8");

// the ownership of direction takes time to establish, so try this until it succeeds
while (true)
{
try {
fs.writeFileSync("/sys/class/gpio/gpio" + pin + "/direction", dir == 0 ? "out" : "in", "utf8");
break;
}
catch (error) {
continue;
}
}

// set the output value
if (dir == 0)
fs.writeFileSync("/sys/class/gpio/gpio" + pin + "/value", lev == 1 ? "1" : "0", "utf8");
};

ext.get_gpio = function (pin)
{
if (pin === '' || pin < 0 || pin > 27) return;

// check the pin is exported
if (!fs.existsSync("/sys/class/gpio/gpio" + pin))
fs.writeFileSync("/sys/class/gpio/export", pin);

// read the pin value
var data = fs.readFileSync ("/sys/class/gpio/gpio" + pin + "/value", 'utf8');

if (data.slice(0,1) == "1") return true;
else return false;
};

// Block and block menu descriptions
var descriptor = {
blocks: [
[' ', 'set gpio %n to %m.outputs', 'set_gpio', '', 'output high'],
['b', 'gpio %n is high?', 'get_gpio', ''],
],
menus: {
outputs: ['output high', 'output low', 'input'],
}
};

// Register the extension
ScratchExtensions.register('Pi GPIO', descriptor, ext);
})();

Penguin5664

eribetra wrote:

when backdrop switches to .backdrop[ v] :: hat events
There is an unnecessary period in this block.
There is an unnecessary mistake in this post.

eribetra

Penguin5664 wrote:

eribetra wrote:

when backdrop switches to .backdrop[ v] :: hat events
There is an unnecessary period in this block.
There is an unnecessary mistake in this post.

Can you please STOP making fun of me?

Also, I wrote the block exactly how it it is on Whiskers, so there is no unnecessary mistake on my post.

eribetra

Penguin5664 wrote:

eribetra wrote:

Penguin5664 wrote:

eribetra wrote:

Wow! Whiskers is very good!

But the “define” block is horrible…
Sorry man but NoMod-Programming explained before he was still working on the define hat, it's buggy and yeah. He got to draw an ellipse but that was slow.
He already responded to me. -_-
You noticed what I said was based on NoMod-Programming reply!?

NoMod-Programming reply?

NoMod-Programming

eribetra wrote:

Penguin5664 wrote:

eribetra wrote:

Penguin5664 wrote:

eribetra wrote:

Wow! Whiskers is very good!

But the “define” block is horrible…
Sorry man but NoMod-Programming explained before he was still working on the define hat, it's buggy and yeah. He got to draw an ellipse but that was slow.
He already responded to me. -_-
You noticed what I said was based on NoMod-Programming reply!?

NoMod-Programming reply?
I fixed it in the latest release.

SimpleScratch wrote:

its in /usr/lib/scratch2/scratch_extensions/piGPIOExtension.js
new (function() {
var ext = this;
var fs = require('fs');

// Cleanup function when the extension is unloaded
ext._shutdown = function ()
{
for (pin = 2; pin < 28; pin++)
{
if (fs.existsSync("/sys/class/gpio/gpio" + pin))
fs.writeFileSync("/sys/class/gpio/unexport", pin, "utf8");
}
};

// Status reporting code
// Use this to report missing hardware, plugin or unsupported browser
ext._getStatus = function ()
{
return {status: 2, msg: 'Ready'};
};

ext.set_gpio = function (pin, val)
{
if (pin === '' || pin < 0 || pin > 27) return;

var dir = 0, lev;
if (val == 'output high') lev = 1;
else if (val == 'output low') lev = 0;
else dir = 1;

// check the pin is exported
if (!fs.existsSync("/sys/class/gpio/gpio" + pin))
fs.writeFileSync("/sys/class/gpio/export", pin, "utf8");

// the ownership of direction takes time to establish, so try this until it succeeds
while (true)
{
try {
fs.writeFileSync("/sys/class/gpio/gpio" + pin + "/direction", dir == 0 ? "out" : "in", "utf8");
break;
}
catch (error) {
continue;
}
}

// set the output value
if (dir == 0)
fs.writeFileSync("/sys/class/gpio/gpio" + pin + "/value", lev == 1 ? "1" : "0", "utf8");
};

ext.get_gpio = function (pin)
{
if (pin === '' || pin < 0 || pin > 27) return;

// check the pin is exported
if (!fs.existsSync("/sys/class/gpio/gpio" + pin))
fs.writeFileSync("/sys/class/gpio/export", pin);

// read the pin value
var data = fs.readFileSync ("/sys/class/gpio/gpio" + pin + "/value", 'utf8');

if (data.slice(0,1) == "1") return true;
else return false;
};

// Block and block menu descriptions
var descriptor = {
blocks: [
[' ', 'set gpio %n to %m.outputs', 'set_gpio', '', 'output high'],
['b', 'gpio %n is high?', 'get_gpio', ''],
],
menus: {
outputs: ['output high', 'output low', 'input'],
}
};

// Register the extension
ScratchExtensions.register('Pi GPIO', descriptor, ext);
})();
Thanks! I'll see if I can do something about either a limited javascript interpreter or some kind of other way of loading scratch 2.0 extensions