Wednesday, July 16, 2008

Throwing Stones I




Written 24 June, 2008

Throwing Stones I

For a while now I’ve been of a mind. The volcano goddess Pele should throw rocks.

Big rocks.

Big, hot, steaming, hissing, semi-molten pumice boulders.

Now, the reader must understand that when it domes to Linden Scripting Language, I’m a kludge. I started out tweaking variables in public domain scripts and it’s been all downhill from there. Although I’m a proud graduate of the College of Scripting, Music, and Science, my approach to scripting is trial-and-error. That didn’t work? Okay, then, how about THIS! Eventually, usually, the script compiles, and usually when it compiles it does pretty much what I want it to do. Usually.

I’d do a lot less trial and error if the LSL Wiki gave more examples or more thoroughly explained the syntax. The Wiki is pretty spare. But I’m not complaining. I’ve been able to rig scripts that make objects do pretty much what I want them to do on Whimsy, and I’ve even been able to occasionally make some fairly complex things happen. But for the record, I miss BASIC, a language at which I was a whiz.

Sooooo, awhile back I decided Pele should hurl rocks when she is erupting and maybe occasionally when she’s not.

I’ve learned how to tell a prim to rez temp objects (thanks, College of Scripting!), and I have a trampoline script. Hmmm, I thought. How about if I wrote a script that would rez a physical prim (the proverbial smoking rock), which would then fall onto the prim that rezzed it, activating a second script, a trampoline script, which would then bounce it into the air in the finest style.

No luck. I would bounce when I hit the prim, but the rocks wouldn’t. It had to do with telling the trampoline which type of object to act upon. The Wiki was no help in giving me syntax.

Okay, no worries. There’s almost always more than one way to make something happen with LSL.

So—hmm, I thought; guns rez and fire bullets, and clearly they’re not using my Rube Goldberg rez + trampoline configuration. So I pulled out my trusty watermelon gun and opened the full perm script and cut out the section that rezzes and fires melons. I dropped it into a new script, set the script so it would be activated by the word “fire” on channel 999 (the Pele eruption cycle works on this channel), and—success! Rocks would catapult into the air, leaving arcing trails of smoke as they splashed into the water or bounced down mountainsides.

Hehe. /999 fire. /999 fire. /999 fire. Sweetie loved it.

The problem was the rock always followed the same trajectory. The speed and direction of the launch didn’t vary.

I discovered the direction of launch varied with the orientation of the prim, but putting in a rotation script didn’t work. That’s because, I think (I just read this) omega rotation operates client-side, meaning the prim doesn’t really rotate; it just SEEMS to.

Okay, then, I could tell the script to rotate the prim X degrees after every launch.

But that seemed inelegant.

So I’m off tonight to play with introducing some variability in the direction and force of the launch. That means I have to come to terms with LSL’s random function.

Wish me luck. I’m gonna need it.

1 comment:

komaramusic said...

Wishes you luck... 9 years later. Following behind, wanting to make a catapult. Thinks path must have been trod by some.