
I have three objects. In these objects, I wish to have an "I have been detached" message announced, using the attach event, like so:
CODE
attach(key attached)
{
if (attached != NULL_KEY)
{
llOwnerSay("Attached");
}
else
{
llOwnerSay("Detached");
}
}
I have three objects, A B and C. Object A is a complicated pet with a fair amount of code in her, utilizing multiple scripts.
Object B is a newer version of Object A, which contains (what I consider) streamlined and more efficient code; the overall amount of code and information and the complexity of said code are far more advanced than Object A, but Object B, in theory, should have more available runtime memory than Object A.
Object C is a prim with only the above script in its default event.
When I attach Object A, it works.
When I attach Object B, it works.
When I attach Object C, it works.
When I detach Object A, and there are no other scripts "running" (i.e. a script with particle events, a 'gun' mode active, etc.), it works.
When I detach Object A, if there are other scripts "running", it doesn't work, and the "deatched" message is displayed upon reattachment.
When I detach Object B, regardless of the states of the other scripts, and even if I put the above into a separate script by itself, it doesn't work.
When I detach Object C, it works.
My question is, why? Why does it work sometimes and not others? According to the LSL, each script has its own individual 16K memory allotment. LSL also says that "[a detaching object] will be given a limited amount of CPU cycles to run its attach event before it is derezed." How much memory is that, and how could I ensure that the attach event is given these CPUs before the others (other than putting duplicate attach events into all scripts and all states, which could cause problems with multiple detach messages)?
I've been messing with this for a while now and I just can't seem to figure out a solution to the problem; rather than continuing to shoot arrows in the dark, I figured I'd ask you kind folks for some advice and wisdom on the subject. Thanks in advance for the help!