Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Return an object to inventory

Andreas DeVaux
Registered User
Join date: 9 Aug 2006
Posts: 1
12-21-2006 17:02
I have an object using a script that follows me around but when I teleport it stays where it is then IMs me to say I forgot it then dies. However I want to use this on a no copy object, how can I get it to return to my(or the owners) inventory instead of dying?

This is the bit of the code that senses where I am in relation to it:
CODE

no_sensor()
{
count += 1;
if(count > 150)
{
repeat += 1;
string name = llKey2Name(llGetOwner());
string pos = (string)llGetPos();
string simName=llGetRegionName();
if(repeat < 2)
{
llInstantMessage(llGetOwner(),name + ", I am lost at:" + simName + pos + ".");
}
else
{
llInstantMessage(llGetOwner(),name + ", Bye !");
llSleep(10.0);
llDie();
}
count=0;
}
}
Boss Spectre
Registered User
Join date: 5 Sep 2005
Posts: 229
12-21-2006 17:37
As far as I know an object cannot directly return itself to your inventory. The only way I can think of coming close to this, is to have the object attach itself to you (requiring a permission dialog), and then once attached, detach itself. Sadly I know of no automatic way to get a warning before you teleport, so you have to warn it... in which case you might as well "take" the object, and not bother with this.

CODE
default
{
touch_start(integer num)
{
while (--num >= 0)
if (llDetectedKey(num) == llGetOwner())
llRequestPermissions(llGetOwner(), PERMISSION_ATTACH);
}

run_time_permissions(integer perm)
{
if (perm & PERMISSION_ATTACH)
llAttachToAvatar(ATTACH_RHAND);
}

attach(key id)
{
if (llGetAttached())
llDetachFromAvatar();
}
}
Of course if the non-copyable object was an attachment in the first place, it would teleport with you.
Aaron Edelweiss
Registered User
Join date: 16 Nov 2006
Posts: 115
12-21-2006 17:53
Well, you can make an object go off world... but there's a chance you might not get it back. So I'm not sure I would recommend that.