Jump to content

TEMP ATTACH AN OBJECT - HOW TO CHANGE TOUCH_START TO ON_REZ?


Pixels Sideways
 Share

You are about to reply to a thread that has been inactive for 172 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

Hiya All!

So I have this temp attach script (below) that works on touch.  I put it in a wine glass so it temp attaches to an avatar on touch. Fabulous.

Now I have a wine bottle that you touch and it rezzes the wine glass with the temp attach.

But you have to touch the wine glass to get it to temp attach. 

What I'd like to do is replace the touch start in the wine glass attach script with on_rez so when the wine glass is razzed, it triggers the temp attach stuff.  I tried replacing touch start with on_rez but it borks bc there is already an on_rez in the script. 

 

I also need to add a start/stop animation for the drinking animation when the glass is attached.

And add a die in 15 secs if the wine glass sits bc an avatar denied the temp attach perms.

 

So how do I get the wine glass attach script to run when the glass is rezzed? 

 

Here is the script.  

default
{
    touch_start(integer num_touches)
    {
        llRequestPermissions( llDetectedKey(0), PERMISSION_ATTACH );
    }

    run_time_permissions( integer vBitPermissions )
    {
        if( vBitPermissions & PERMISSION_ATTACH )
        {
            llAttachToAvatarTemp( ATTACH_LHAND );
        }
        else
        {
            llOwnerSay( "Permission to attach denied" );
        }
    }

    on_rez(integer rez)
    {
        if(!llGetAttached())
        { //reset the script if it's not attached.
            llResetScript();
        }
    }
}

 

 

thank you!

xoxo pixels

Edited by Pixels Sideways
...
Link to comment
Share on other sites

Thank you, Quistess.  It's still confusing to me but I kinda get the who is the object going to attach to issue,  

 

Seems to me the person touching the giver (wine bottle) should be recognized as the receiver of the object (glass)  to attach - like a giver script works when it sends the person who touched the giver an object into their inventory. Simple.  lol

 

I have purchased things that do this - touch a tray of cookies or a wine bottle and it either auto attaches a cookie or glass of wine bc it likely has some experience thing set up via AvSitter or it asks for permission to attach.  Both totes skip the rez step.

Link to comment
Share on other sites

3 minutes ago, Pixels Sideways said:

Both totes skip the rez step.

AVsitter rezzes the thing and then tells it who to attach to. The only way to "skip the rez step" is to use RLV, where you give the object to the wearer using a special folder via llGiveInventoryList, and then politely ask their relay (assuming they're wearing one) to 'force' them to wear the contents of the folder.

Link to comment
Share on other sites

2 hours ago, Pixels Sideways said:

I have purchased things that do this - touch a tray of cookies or a wine bottle and it either auto attaches a cookie or glass of wine bc it likely has some experience thing set up via AvSitter or it asks for permission to attach.  Both totes skip the rez step.

I was actually going to suggest using AVsitter for this because a lot of people already enable the AVsitter experience, so for them, on land enabling the experience, it will "just work" without needing to keep explicitly asking the recipient for permission.

The AVsitter scripts for this functionality are open source so you can study them to see how they work, but they have extra complexity to interact with all the other AVsitter scripts when needed. For simple attachment, all you need are the AVobject script in the attachment and, in the rezzer, the AVprop script, an AVpos notecard with appropriate PROP1 to identify the thing to be attached, and a tiny script that emits a 90220 link message when touched to tell the AVprop script to start the rez-and-attach process and for whom (the toucher). The AVobject script needs to be the one compiled with an experience, and using the one already compiled with the AVsitter experience is what makes it work for folks who are already using AVsitter PROP1 attachments for other stuff.

Because of the complexity of the AVsitter scripts, you may prefer to write your own instead, with or without your own experience.

  • Like 2
Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 172 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...