Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Attachment rezzing, permissions, and attachment deletion

Ledneh Moreau
Registered User
Join date: 14 Jan 2005
Posts: 6
02-01-2006 23:19
I'm working on an avatar system that changes your avatar based on triggers in chat. Essentially, the idea is to change to a particular avatar when a particular trigger is encountered.

Right now, my solution is to make an invisiprim with the following contents:

- meatball animation and meatball-on-attach script
- all of the triggerable avatars, each of which contain a script I'll clarify below
- a script that does nothing but watch chat for the triggers

This listen script, when it encounters a trigger, detaches the current avatar (deleting it in the process, theoretically, since a copy is still in the invisiprim's contents anyway), rezes the relevant avatar nearby the agent. Now, each of these avatars has their own script that, on rez, requests attach permissions, then attaches once permission is granted (or just, er, sits there if permission is denied--I'm still working on that ;)).

Now, my problems with this are, uh, manifold:

1) Everytime an avatar requests permissions, the user is prompted (ie. granted permissions are lost between rezes of any one avatar). Therefore, every time the trigger is encountered, the user has to click Yes to attach it. This is, er, lame. Any workaround?

2) While the avatar is being worn, it exists in the user's inventory, nothing I can do about that. If it is detached, it becomes part of the user's inventory. If it's DROPPED, right now the way the script is set up, it dies, removing itself from the user's inventory--which is what I want. The problem here is, as far as I can tell, LSL has no support for dropping attachments--only detaching them. What can I do to make damn sure that, when one of the avatars is detached, it is removed from the user's inventory?

3) It seems like there's a better solution out there for what I want to do, but I don't know what it is. Is there any other general way I could do all this that I haven't thought of?

Here's the scripts as they are right now. This is the listener script in the invisiprim, that does all the management:

CODE

string currentEmoticon = "";
integer listenHandle;

default
{
attach(key id)
{
if (id != NULL_KEY)
{
llOwnerSay("Emoticon Costume Ready! Listening to chat...");
llListenRemove(listenHandle);
listenHandle = llListen(0, "", NULL_KEY, "");
}
}
listen(integer channel, string name, key id, string message)
{
if (llSubStringIndex(message, "D:") != -1)
{
llOwnerSay("Caught Emoticon D:");
if (currentEmoticon != "")
{
// detach and destroy current emoticon
}
llRezObject("D: Face", llGetPos() + <0, 0, 2>, ZERO_VECTOR, ZERO_ROTATION, 42);
}
}
}


And this is the script within each avatar that attempts to attach itself to the avatar on rez, and die on detachment (remember, it doesn't die if it's detached, only if dropped--this is bad):

CODE

default
{
on_rez(integer arg)
{
//llOwnerSay("Hello, Avatar!");
if (llGetPermissions() & PERMISSION_ATTACH)
{
llAttachToAvatar(ATTACH_BELLY);
}
else
{
llRequestPermissions(llGetOwner(), PERMISSION_ATTACH);
}
}

run_time_permissions(integer perm)
{
if (perm & PERMISSION_ATTACH)
{
llAttachToAvatar(ATTACH_BELLY);
}
}
attach(key id)
{
if (id == NULL_KEY) // detached
{
llDie();
}
}
}


My thanks to anyone who can help!
_____________________
Eloise Pasteur
Curious Individual
Join date: 14 Jul 2004
Posts: 1,952
02-02-2006 03:37
Um, I'm pretty sure you're stuffed at least as you've posed the questions!

If you don't kill the object it will retain permissions across rerezzes etc. that would stop the reasking permissions.

There's no way through scripting to affect someone's inventory - stops people emptying your inventory with inventive little trojan horse type scripts amongst other things.

There's no way to force a user to drop rather than detach an object.

I'm sorry, I still think the OO coder in you is going to be offended - the folder approach is still the best we have in SL.
Ledneh Moreau
Registered User
Join date: 14 Jan 2005
Posts: 6
02-02-2006 01:54
From: Eloise Pasteur
Um, I'm pretty sure you're stuffed at least as you've posed the questions!

If you don't kill the object it will retain permissions across rerezzes etc. that would stop the reasking permissions.

There's no way through scripting to affect someone's inventory - stops people emptying your inventory with inventive little trojan horse type scripts amongst other things.

There's no way to force a user to drop rather than detach an object.

I'm sorry, I still think the OO coder in you is going to be offended - the folder approach is still the best we have in SL.

Heh, this problem and the other one about implementation hiding are only tangentially related--I'll do whatever it takes to be able to attach avatars based on chat triggers.

The thing is, there's no way as far as I can tell for LSL to rez an object from the user's inventory--only from the inventory of the scripted object itself. Otherwise, I'd just put all the avatars in a folder with the invisiprim (instead of in the invisiprim itself), and that way, permissions would be maintained and I wouldn't have to worry about deletion--problems solved.

But I can't do that. :(
_____________________
Ledneh Moreau
Registered User
Join date: 14 Jan 2005
Posts: 6
02-02-2006 02:00
Whoa, why did my reply come out ABOVE your post? O_O
_____________________
Eloise Pasteur
Curious Individual
Join date: 14 Jul 2004
Posts: 1,952
02-02-2006 13:51
Hmm as for replies appearing first - time warp has been affecting the fora all day apparently!

As for your issue -

If you're going to rez from within the inventory of the object each time you need to give it copiable contents so it stays there and copies and attaches. That will result in requesting permissions each time but give you voice activated attachment. There's no "die" control for detached objects and no scripted way to affect an avies inventory except for giving them things.

You could make the contents no transfer to stop people handing them around though...

If you allow people to drop items and then save back to object inventory if highlighted (I've not tried it so I'm not sure it will work) they should keep the perms for attaching. That's OK for you, but ugly for other people and it seems you're planning on selling it. It would give people the choice though I guess, they take the attachment perms questions *or* saving back to object inventory if available.

Inventory control in SL is pretty tightly controlled to stop things like naked guns, steal inventory guns etc... It also stops some of the ideas you're having though, or makes for work arounds.
Ledneh Moreau
Registered User
Join date: 14 Jan 2005
Posts: 6
02-02-2006 17:35
From: Eloise Pasteur
Hmm as for replies appearing first - time warp has been affecting the fora all day apparently!

As for your issue -

If you're going to rez from within the inventory of the object each time you need to give it copiable contents so it stays there and copies and attaches. That will result in requesting permissions each time but give you voice activated attachment. There's no "die" control for detached objects and no scripted way to affect an avies inventory except for giving them things.

You could make the contents no transfer to stop people handing them around though...

If you allow people to drop items and then save back to object inventory if highlighted (I've not tried it so I'm not sure it will work) they should keep the perms for attaching. That's OK for you, but ugly for other people and it seems you're planning on selling it. It would give people the choice though I guess, they take the attachment perms questions *or* saving back to object inventory if available.

Inventory control in SL is pretty tightly controlled to stop things like naked guns, steal inventory guns etc... It also stops some of the ideas you're having though, or makes for work arounds.

Man, what a mega drag. I was gonna make millions of Lindens off this. MILLIONS!

It was gonna be so damn cool. If I could just rez from a user's inventory instead of having to have the rezzable object be in the scripted object's inventory, then this would be a snap: permissions save between rezzes, no need to worry about deleting them from user inventory... it'd be perfect. Damn it all.

Hmm. Actually, that sort of gives me an idea. Can a rezzed object communicate with scripted objects in the owner's inventory? Like, have a master script send an event to the avatars in the user's inventory, for example? As in, rather than have the master script/object request the attachment of another object, tell that object "hey, wake up, attach yourself" instead?

That's confusing, I know, and I suspect it wouldn't work--user inventory objects that don't exist in the world probably aren't running or watching their scripts at all. But still, maybe it would...
_____________________
Rodrick Harrington
Registered User
Join date: 9 Jul 2005
Posts: 150
02-03-2006 00:43
answered your own question :) they are in suspended animation when in inventory :)