In the Wiki it says:
key llDetectedKey(integer number)
Returns the key of detected object number (returns NULL_KEY if number is not valid sensed object).
which makes it look to me as if it will return the key of the Object Being Touched, in this case the key of the Root Prim - '0'.
However, I assume it gets used in an example like this (from the Wiki) because it works to identify the key of the Avatar/Agent touching the object, and in this case sending an IM to that key.
touch_end(integer num_detected)
{
llSetTimerEvent(0.0);
llInstantMessage(llDetectedKey(0),llDetectedName(0) + " you held down your mouse button for " + (string)time + " seconds."
;time = 0.0;
}
}
So - for the purposes of the Wiki is an Avatar/Agent an object?????? Is it something to do with the number (0)??
I'm trying to debug a script that always works for me but hangs with a new owner.
Is there any problem with doing something like this to reliably get the key of the new script owner.
Av_Key = llGetOwner();
Av_Name= llKey2Name(Av_Key);
if (llDetectedKey(0) != Av_Key)
{
llSay(0,"Sorry - only the owner " +Av_Name+ " can adjust me "
;state_entry();
}
llSay(0," HI " + Av_Name);