Jump to content

Looking for a single use script that deletes item after playing animation


Recommended Posts

Is there such a thing? Optimally I'd like say..a plate of food or mug of ale that plays an eating/drinking animation when attached and then disappears from the person's inventory. Is this possible? I searched in Marketplace but maybe I'm not searching the correct terms..

Link to comment
Share on other sites

That's not possible -- there is no scripted way to delete inventory.  The best you could do would be to have a script that would play the animation and after a set time set a "used" flag of some sort and detach.  Then if the object is tried to be worn again later it'd give a simple error to the wearer/owner and detach without doing anything else.

  • Like 1
Link to comment
Share on other sites

Just now, Anna Salyx said:

That's not possible -- there is no scripted way to delete inventory.  The best you could do would be to have a script that would play the animation and after a set time set a "used" flag of some sort and detach.  Then if the object is tried to be worn again later it'd give a simple error to the wearer/owner and detach without doing anything else.

Don't certain Xeolife enabled items disappear after consumption? The description of the script says it auto-deletes the item from your inventory once you've used it a certain number of times.

  • Like 1
Link to comment
Share on other sites

Items attached temporarily (llAttachToAvatarTemp) can be detached and be deleted permanently when done, but if the person has taken it into personal inventory and they can see it in personal inventory than it can only be deleted manually by the person, not through a script.  Now, I don't know Xeolife, but I suspect (best guess) that what is happening there is that items are being put into a container, a holding object (either rezzed int world or worn as a HUD), and that holding object would then attach the item to the avatar temporarily and when done, it'd be deleted from the containers inventory after conditions are met.

  • Like 1
Link to comment
Share on other sites

8 minutes ago, Anna Salyx said:

Items attached temporarily (llAttachToAvatarTemp) can be detached and be deleted permanently when done

That's probably the best way to approach this challenge. Put a temp_on_rez food item into a rezzer, to be rezzed on demand by whoever is going to "eat" it.  When rezzed, the object asks for PERMISSION_ATTACH. When the person who rezzed it gives permission, the object uses llAttachTo AvatarTemp to attach.  In the object's attach event, it then triggers the eating animation and starts a timer.  A minute or so later, when the timer triggers, it uses llDetatchFromAvatar to get rid of the attachment.  I have used this approach for several clients who sell products for dining room use.

If you were scripting in an Experience, you could shortcut this sequence a bit because PERMISSION_ATTACH is granted automatically. The temp_on_rez  status isn't truly necessary, but it takes care of cleanup if the person walks away without giving PERMISSION_ATTACH.  For an extra touch of realism, you can make the rezzer itself become transparent temporarily when it rezzes the food item.  That makes it appear that the person who chooses the food has grabbed it and attached as one act.

  • Like 3
Link to comment
Share on other sites

12 minutes ago, Amberyl Ethaniel said:

I'd like to find out about experience.

The basic information about Experiences is in this Knowledge Base article:

If you are a Premium member, you may own an Experience and make it active on your land.  If you are a scripter, you may write scripts for an Experience if you are either a Premium owner or have the Experience Contributor role in a group that an Experience owner has created for that purpose.

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...