Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Can there be famous last words?

HtF Visconti
Registered User
Join date: 21 Jul 2006
Posts: 123
09-04-2006 00:31
Hi,

I am again far from SL access and so I cannot test .... when a prim/object is deleted - is there a chance to have it say a message before it is removed?

The reason why I am asking is that I have a device that will spawn unlinked poseballs. So - before I change the pose I'd like to know if the ball is still around or if some funny being deleted it. I can, of course, scan for it but I'd prefer a less ressource intense alternative. So - if the poseball could utter some final words before it leaves this plane of existence forever - this would be my preferred way to do it.

Edit: I know temp objects die more or less instantly and without further ado - does the same hold true for non temp objects as well?
Kayla Stonecutter
Scripting Oncalupen
Join date: 9 Sep 2005
Posts: 224
09-04-2006 01:29
From: HtF Visconti
.... when a prim/object is deleted - is there a chance to have it say a message before it is removed?
Nope. Only time 'parting words' can be done is when detaching from an avatar. Derezzing by any other means (Take, Delete, llDie(), Temp-on-rez, etc) offer no way to have the script do anything before it goes.

Alternative to llSensor(): Have the controller issue a llSay() or llWhisper() that the poseballs will respond to. If you pick an unusual channel, the listens wouldn't take too much sim resources.
_____________________
HtF Visconti
Registered User
Join date: 21 Jul 2006
Posts: 123
09-04-2006 04:56
Thanks for the info - I was *afraid* of this. :)

The trouble with the listener is that it only works 100% if you have the queried for object to talk back. I had a tough time to figure out how to check for the availability of cuffs. When you send 'em a ping and they respond it's cool - only .... when there *are no* cuffs you get no reply.

Unfortunately - unlike no_sensor - there is no negative to a listen. So basically you either use a timer and check if an answer came in or you llSleep a bit, then fire off a termination message on the protocol channel and check in the listener if what you got was an answer or the termination message. If you only got the termination .... you can be *pretty* sure there were no cuffs to answer. Unless you have lots of lag ... or made the llSleep too short .... kinda roundabout and the actual logic is then split between touch, change, and listen ... ack! So much for code maintenance :)

So currently the sensor appeals to me. Single sweep - if the poseball is not within range we shout a deletion message anyway (just to make sure - I'd hate to get a synchronized poseball dance troupe) and then rez us a fresh and unused poseball.
Strife Onizuka
Moonchild
Join date: 3 Mar 2004
Posts: 5,887
09-04-2006 10:10
If your object rezed them, then it knows the keys of the poseballs (rez_object event). From this you can then use a timer to reguraly scan for them with llKey2Name or llGetBoundingBox. With this technique you can scan for as many keys as you can stored in a list. Something like...

CODE

list objects;
list names;

default
{
object_rez(key id)
{
if(objects == [])
llSetTimerEvent(5.0);
objects = id + objects;
names = llKey2Name(id) + names;
}
timer()
{
integer a = ([] != object); //faster then -llGetListLength, same result.
do
{
if("" == llKey2Name(llList2Key(objects, a)))
{
llMessageLinked(LINK_THIS, 1, llList2String(names, a), "");
objects = llDeleteSubList(objects, a, a);
names = llDeleteSubList(names, a, a);
}
}while(++a);
if(objects == [])
llSetTimerEvent(0.0);
}
}
_____________________
Truth is a river that is always splitting up into arms that reunite. Islanded between the arms, the inhabitants argue for a lifetime as to which is the main river.
- Cyril Connolly

Without the political will to find common ground, the continual friction of tactic and counter tactic, only creates suspicion and hatred and vengeance, and perpetuates the cycle of violence.
- James Nachtwey
Tuach Noh
Ignorant Knowlessman
Join date: 2 Aug 2006
Posts: 79
09-04-2006 12:54
From: Strife Onizuka
scan for them with llKey2Name or llGetBoundingBox.


That's very clever. Thanks for the idea!