Wednesday, October 1, 2014

Timers are essential tools. We need them for a variety of reasons--- to play sounds or make particles at specified intervals, to time out blue menus, to stop prims from listening (and save server resources), or to pace changes in a prim's position or characteristics.

It's possible to use multiple timers (and I will eventually write about this), but for now, here's an annotated script that will play a click sound at a specified interval after the prim has been touched.

Saturday, September 13, 2014

Hovering or floating text is that sometimes annoying lettering that appears above (and sometimes in front of) a prim.

Hovering text can be any color, can be broken into multiple lines, and can be solid or transparent. Messages are limited to 254 bytes. The distance at which hover text can be viewed is dependent upon the size of the prim. Bigger equals visibility at a longer distance.

Hovering text is set by a script, and will remain even if the script is removed from a prim. The Scrubber script I shared will remove it, or, if the script is still in the prim, you can remove the text between quotation marks in the llSetText line so it reads "". The official way to remove hover text, however, is with the line that follows:

Thursday, September 11, 2014

Finding Scratch for Second Life was huge for me. It enabled me to move prims nonphysically, something I had been trying and failing to do.

Scratch does a lot more than move prims, however.

Scratch is a program developed by Eric Rosenbaum at at the MIT Media Lab. In essence, it's a programming language that allows you to build a script by assembling modules which are respresented as blocks. When you're finished, Scratch will generate code which you then paste into a script inside your prim.

To use Scratch, watch the three-minute tutorial, then download and run the small program and start moving blocks about. It will take you only a few minutes to create your first Scratch script.

Scratch doesn't do everything one can do with LSL, but it can do quite a lot. Here are its functions:

Moving Prims

Move prims forward or backward X meters.

Turn prims X degrees left or right

Move up or down X meters

Roll plus or minus X degrees

Pitch plus or minus X degrees

Point toward nearest avatar

Point toward owner of prim

Point in direction X

This allows you to turn a prim and move it in any direction. Movement is limited to ten meters, but it's easy to do sequential movements.

Control

Respond to touch

Respond to collision

Respond when rezzed

Respond to chat

Wait X seconds

Repeat an action X times

Broadcast (Say things)

Respond differentially using if and else

Looks

Say

Set hover text to specified color

Change color by X amount

Set color to specified vector

Set level of transparency

Change size of linkset by plus or minus X percent

Sound

Play sound from Script's short list of sounds

Play your own sound

Sensing

Determine distance to nearest avatar

Determine distance to owner

Determine number of avatars within range X meters

Numerical Calculations

Addition

Subtraction

Multiplication

Division

Generate random number between 1 and 10

Less than

Equal to

Greater than

Variables

Create or delete a variable

Pen

Clear

Pen down

Pen up

Change pen color by X amount

Set pen color to X

The pen requires a scripted prim called lineSegment. I don't remember how I acquired mine, but it's full perm and I'll be happy to pass a copy to you. Just IM me in world or drop me a notecard.

In my early days in Second Life I picked up a free full-perm lightning bug script by Ama Omega; its name was Foxfire.

The script was set to turn fireflies on at sundown and off when the sum came back up. I managed to change that so they were active 24/7.

As fireflies go, Ama's weren't bad, but Sweetie (a recurring character in Chey's Second Life Blog) wanted to tweak them. Fireflies she said, weren't yellow, but yellow-green. These didn't stay on quite long enough-- and they were too dense and not quite wide-ranging enough. And oh, yes, didn't fireflies come out only at night/ Why did these flash all day?

I had her apply color to a prim and, by doing some calculations, soon had the script making fireflies of the same shade. With Sweetie over my shoulder, I tweaked the script, making the flashes last a little longer, thinning the field of fireflies, and dispersing them over a wider range. Then I stayed online through a full four-hour Second Life day cycle and discovered just the right moment to turn them on (real life fireflies start just as its dusk). Real life fireflies stop flashing after a few hours, but I conveniently ignored that fact of biology and turned them off when the sum was just above the horizon. Then we spent an evening walking around Whimsy finding the old fireflies and replacing them with the new ones. Using beacons made that relatively easy. Here's my post about the process.

Below you'll find my modified firefly script, and below that Ama's original Foxfire Script. Ama did a great job, but I think you'll find my tweaks make for a nicer effect.

You can drop the script into rocks, trees, or just about anywhere. Fireflies will come out as it begins to grow dark and disappear before it's fully light. Please note, The fireflies are responding to the Second Life day cycle on your sim, and not to your viewer setting of midday, morning, evening, or midnight.

Thursday, August 14, 2014

It can be annoying when you have a prim that makes a sound you can't turn off, or produces particles you can't turn off, or has a sit position you can't turn off, or has a texture animation or an omega rotation you can't turn off. Even if the script is removed, the prim's behavior persists. It can drive you crazy.

The Scrubber is a handy script that rids a prim of just about any residual effect of previous scripts and then handily deletes itself. You just open the Edit window, click the Content tab, drag the script from inventory, let go of it, and it does its work in seconds.

Scripting in Second Life is made difficulty by the arcane Linden Scripting Language and even more by the unwillingness of most coders to share their knowledge or their scripts It's as if it becomes double-secret need-to-know if the modify a single line.

My purpose in this blog is to share what I have learned about scripting in Second Life and provide you with free full-permission scripts to use as you wish. I ask only that you not charge others for them unless you significantly modify them. By significantly I mean you add functionality to the script-- not just change variables or chat messages.

Much of the work will be mine. Some of it is in the public domain. When that is so and when I know the author, I will acknowledge the author(s) in text and in the code of the scirpt.

On this blog I will describe scripts and paste the LSL code for you to copy and put in your own prims. Some scripts will be simple, and some quite complex. I hope there will be something for anyone who wishes to make prims misbehave.

I have dedicated a portion of my Flights of Fancy store to providing scripts in world. Go here to visit my store and here to teleport directly to the scripting area. If you visit shortly after I post this, don't be surprised if there's not much there. There will be more later, I assure you.

Search This Blog

Complexity Rating

About Me

Chey is having a fabulous second life, thank you very much. She is owner of Flights of Fancy Creations, where you can find things you want and things you need. She can usually be found with her over-the-top partner Sweetie on their sim Whimsy, a tropical archipelago with an active volcano and a kickass steam train-- or perhaps on Whimsy Kaboom at the robot sanatorium, home to the many mentally malfunctioning mechanoids of the Metaverse.

About This Blog

My purpose in this blog is to share what I have learned about scripting in Second Life and provide you with free full-permission scripts to use as you wish. I ask only that you not charge others for them unless you significantly modify them. By significantly I mean you add functionality to the script-- not just change variables or chat messages.

Much of the work will be mine. Some of it is in the public domain. When that is so and when I know the author, I will acknowledge the author(s) in text and in the code of the scirpt.

Some scripts will be simple, some more complex. I hope that whatever you need, you will find something useful here.