|
Darkhorse Golem
Registered User
Join date: 25 Oct 2005
Posts: 23
|
09-29-2006 03:45
Hi, after getting 30 somthing emails from sl telling me my Gull has been returned from Hong Kong, i did a bit of searching for a self destruct script for lost objects.
this is the script i have found.
----------------------------------------------------
integer gCount; integer gDieAt = 999; //tunable float gInterval = 10; //seconds (also tunable)
default { state_entry() { llSetTimerEvent(gInterval); } timer() { if(llGetLandOwnerAt(llGetPos()) == NULL_KEY) { if(gCount >= gDieAt) llDie(); gCount ++; } else { gCount = 0; } } }
This code will check every ten seconds what the land owner is at the current object's position. If the land is public (land owner = NULL_KEY), it adds one to count. If it isnt, it resets the count (just incase the object is a vehicle that just moved over some public land that one instance.)
created by christopher omega
EDIT: Xerahn VonLenard, ty so much... Adding >= to the if(gCount >= gDieAt) is definately more stable then if(gCount == gDieAt)... just in case the sim hiccups. Ty so much for the input.
-------------------------------------------------------------------------------- Last edited by Christopher Omega : 01-03-2004 at 10:16 PM.
it looks good but it assumes that the object gets lost on public land
is there a way of changing it to self destruct an object that has crossed over to a new owners land?
something like this.
on rez reset script, get name of land owner. wait 10 seconds if current location land owner different from on rez land owner, self destruct.
i'm still at the tweeking scripts stage of my learning about scripts so a little help here would be great thanks.
this script will also benefit other creators who have the same problem as me.
|
|
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
|
09-29-2006 03:56
From: Christopher Omega
it looks good but it assumes that the object gets lost on public land
is there a way of changing it to self destruct an object that has crossed over to a new owners land?
something like this.
on rez reset script, get name of land owner. wait 10 seconds if current location land owner different from on rez land owner, self destruct.
i'm still at the tweeking scripts stage of my learning about scripts so a little help here would be great thanks.
this script will also benefit other creators who have the same problem as me.
have you tried using llOverMyland instead? The caveat being grouped land. The following will script will make the object self destruct after being on land not owned by the owner of the script. integer gCount; integer gDieAt = 999; //tunable float gInterval = 10; //seconds (also tunable)
key myId;
default { state_entry() { llSetTimerEvent(gInterval); myId = llGetKey(); } on_rez(integer num) { myId = llGetKey(); } timer() { if(llOverMyLand(myId) ) { gCount = 0; } else { ++gCount; if(gCount >= gDieAt) llDie(); } } }
EDIT: Actually that isnt what you asked is it Christopher? I think this is what you actually wanted? Every time it Rez's it gets the land owner. It then uses this to check for being on different land and increments the counter etc. integer gCount; integer gDieAt = 999; //tunable float gInterval = 10; //seconds (also tunable)
key RezOwner = NULL_KEY;
key GetLandOwnerKey() { return llGetLandOwnerAt(llGetPos()); }
default { state_entry() { RezOwner = GetLandOwnerKey(); llSetTimerEvent(gInterval); }
on_rez(integer num) { RezOwner = GetLandOwnerKey(); }
timer() { key curr = GetLandOwnerKey(); if(curr != RezOwner) { if(gCount >= gDieAt) llDie(); gCount ++; } else { gCount = 0; } } }
Obviously if you want it to immediately self destruct just get rid of the gCount check and call llDie. if(curr != RezOwner) llDie();
If this is to stop someone 'stealing' something it wont work to well. All they need to do is rez in a no script sim, delete the script and they are safe.
|
|
Darkhorse Golem
Registered User
Join date: 25 Oct 2005
Posts: 23
|
Great scripting, thanks.
09-29-2006 04:35
christopher was the origional creator of the script i found.
But what you have produced is great thanks.
i have a Seagull rezzer, they should stay about 15 meters around the rezzer but i think there is a space warp kidnapping them and spitting them out sims away, lol, but they then find a way into a full parcel and gets returned to me, including messages and if i'm offline emails as well.
the common land self destruct wouldnt have worked if they had wandered on to another owned land and the other script i found that self destructed if they got too far away from my avitar wouldnt have worked because as soon as i logged off all my gulls would die.
but what you have produced looks great thanks.
|