Monday, July 21, 2008

Another Impossible Task




Written 21 July, 2008

Another Impossible Task

Sweetie is always setting impossible building and scripting tasks for me.

“Oh, nice door. But wouldn’t it be cool if it was a big metal door in three sections like an airlock? And of course you’ll need a space station to go with it. And we’ll need a big rocket so we can ride up to it. And spacesuits! We must have spacesuits! And laser guns! Can you have it all by tomorrow?”

Most recently, Sweetie decided she wanted a walking broom. Yeah, like the broom in the Sorcerer’s Apprentice segment of Walt Disney’s Fantasia.

Think about it: a broom that walks, carrying buckets of water.

And not only that; she wanted a version that would grab itself and work its handle to sweep the floor.

I tried to tell her there’s no dirt to sweep in Second Life, but she clouded up. “Sweetie must have her self-sweeping broom!”

And so I made one for her.

Making a broom wasn’t too difficult. I made the bottom flexible so it would sway with the broom’s movement (thinking optimistically that I could eventually make it move!).

I made two sets of arms. One pair hung more or less loosely at the broom’s side; the second grasped its handle, hand over hand.

Fortunately, I had been experimenting with a rez-on-touch bridge (another Sweetie request),and had learned how to turn prims invisible on touch. I adapted the script, and by experimenting to find the numbers of the various prims, I managed to make the broom change arms on touch. The relaxing arms would disappear and the sweeping arms would appear—until the timer ran out.

The trickiest part was moving the broom. I used a script from an elephant ride to make the broom rock from side to side like a seesaw, but when I linked an axis prim and made it rotate, the broom went nuts.

I thought about making the broom follow its owner, but that wasn’t particularly what I wanted it to do. I also thought about using Puppeteer, but I knew that would make the movement awkward.

I had just decided to script a string of commands to made the broom walk when I saw this weekend’s blog from Torley Linden. He talked about several scripting tools. One, called Scratch, caught my attention. It builds scripts out of Second Life by allowing the user to move blocks into a string in a program area; it’s like Lego LSL. It sounded perfect for the long string of movement and rotate commands I would be using.

So I downloaded Scratch, and in about 30 minutes, my broom was walking. Thank you, Scratch!

Woo hoo!

No comments: