Monday, April 13, 2009

A Scripting Interlude

While revisiting my genetic drift module and starting my natural selection module, I decided to fix a potentially annoying problem. Since Caminalcules rez as physical objects sometimes they behave really flaky and end up in other regions. Right now they are set to die on their own after a set time but that would be a scant comfort to another land owner who has one of these things appear on her land.

With the help of the good folks in the College of Scripting Music Science group here's the basic strategy...

default {
// check if the touching person is over the script owner's land

if (llOverMyLand(llGetKey())) {
llSay(0, "the prim is on my land.");
} else {
llSay(0, "the prim is NOT on my land.");

Not real hard and experienced scripters probably know about llOverMyLand, but it solves one of life's little mysteries. I can of course shorten this to a single if statement if I just want the critter to die, but I might want different sorts of behavior depending where the critter is, hmmmmm.

By the way, since I have several parcels, I was interested to find that llOverMyLand doesn't care what parcel the object is in just whether or not you own the parcel.

No comments: