Squeaky Time!

I think I’m starting to understand how to play with Squeak’s eToys environment. It helped to explore it with a five year old by my side.

In this environment, you give objects “scripts.” Scripts can contain primitive commands like “move forward 5” or “make a squeaking noise,” or tests like “Is ___ true? If so, __ if not __”, or even other scripts. Yep, it’s just like programming. Objects can tell if they’re overlapping other objects or other parts of their environment. Oh yeah — when I say “objects” I’m not just talking about abstract programming objects — one way to create a new object is to draw it with a pen. Another is to pull it out of a box, a box with rectangles and stars and other things. Once you’ve got an object you can give it a name and add scripts to it. Besides adding scripts you can manipulate it directly by grabbing it, dragging it around, resizing it, recoloring it, turning it sideways, whatever.

Oh, and the scripts — you can see them. They’re little boxes and you add commands to them not by typing, but by dragging little tiles onto the box. It’s amazingly easy.

A script can be “ticking,” which means it fires repeatedly until you stop it. It can also be stopped. Objects can turn their own or other objects’ scripts on or off.

By the time things started getting interesting, this is what was going on —

We had a little alien face made out of a little drawing my son had made with some eyes added to it. The alien had some scripts we’d written, like “crawl” which sent it forward slowly, and “move warble and turn” which sent it backwards a bit, made it turn, and made it make a warbling noise.

I at first had the idea of making a box which could clone the alien face, but I didn’t quite know how to do that… So I made a box which could tell if an alien was touching it, and turn blue if that was the case, and red if it wasn’t. OK, that was cool. But it was cooler when in addition to making it turn blue, it told the alien face to “move warble and turn.”

Now you could make the alien face crawl at the box, and when it hit, the box would flash blue and the alien would warble, turn, and back up — and then the crawl could keep going.

Then I made four copies of the box, and was happy to see they all had the same power of making the alien warble! I elongated them and made a cage out of them, and let the alien face bounce around inside back and forth. Twas cool. I made the alien face smaller so it didn’t hit so often, and could spend more time crawling, not constantly bouncing.

Before all this I’d drawn a little mouse and not done anything with it. I picked it up and started scripting it. First I called it “SketchMouse” but by this time my daughter had showed up and insisted it should be called “StickMouse,” so Stickmouse it was. I gave Stickmouse a script called “run” and made the stickmouse check to see if it was touching an alien, and if so, it would turn the StickMouse’s “run” script to “ticking” — and it would keep running until it wasn’t touching an alien anymore. I added a squeak to the mix; a mouse in Squeak should squeak!

Now the alien would run around bouncing off the walls, and when it happened to hit a mouse the mouse would squeak and wiggle out of the way.

Then I started cloning off a half dozen new Stickmice and let the fun begin!

What I took away from all this is that eToys isn’t about showing up with an idea of what you want to do and finding the tools to do it. It’s about building cool little things and seeing what happens when you tweak them and throw them at each other — seeing what emerges, that you would have never thought of before.

In retrospect I can also see much more effective ways I could have done things. First off, it was kind of silly to have all those paranoiac boxes waiting for an alien to show up so they could make it do a silly dance. Why couldn’t I just make the alien watch for boxes while it’s moving, and do its silly dance when it hits one? Then I’d have one entity “active” instead of a bunch of them.

Same thing with the mice — they were all watching out for that alien. Why couldn’t the alien have, say, triggered their “run away” script when it touched them, and then the “run away” script would itself have checked to see whether they’d escaped it and turned itself off when it was satisfied it had? Things like that.

And it’s all gloriously useless. It’s pure fun.