Jump to content

continuing: Attach and Detach troubles


Domitan Redenblack
 Share

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

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

Recommended Posts

 

key gkRecentToucher;

default
{
    state_entry()
    {
        // llSay(0, "/me is afk ...");
    }
    
    touch_start(integer total_number)
    {
        llPlaySound("YosemiteSam_GoodbyeRabbit", 1.0); // play "mysound" when touched.
        gkRecentToucher = llDetectedKey( 0 );
        if (gkRecentToucher != llGetOwner( )) return;

        llSetObjectName("Domitan Redenblack");
        llSay(0, "/me is back ...");
        llSetObjectName("AFK Sign");
        
        llSetTimerEvent(3);
    }

    attach(key attached)
    {
        if (attached == NULL_KEY) return; // ignore detach
        
        // When attaching...
        llSetObjectName("Domitan Redenblack");
        llPreloadSound("YosemiteSam_GoodbyeRabbit");
        llSay(0, "/me is afk ...");
        llSetObjectName("AFK Sign");
    }

    timer( ) {
        if (gkRecentToucher == llGetOwner( )) 
            llRequestPermissions(gkRecentToucher, PERMISSION_ATTACH);
            gkRecentToucher = "";
    }

    run_time_permissions(integer perm) {
        if(perm & PERMISSION_ATTACH)  llDetachFromAvatar( );
    }
}

 The above code mostly works well, but sometimes the "Goodbye" from Sam gets cut off very early. Why? There does not seem to be lag when I click the object, and he starts to speak immediately, but is cut off long before the 3 second timer( ) trigger to detach.

Is the timer set off early?

 

 

Link to comment
Share on other sites

I don't see clearly why you have a delay before requesting attach permission.
Another thing is that the timer will still be running next time you attach.
You have no timer stop or script reset.
Also, if somebody else but the owner touched or nobody touched before the object is attached to the owner, you will never get any attach permission.

If the cut off you talk about is in the played sound it may be because the sound playing is viewer side and is not played before it is loaded into the viewer.

Link to comment
Share on other sites

 


Dora Gustafson wrote:

I don't see clearly why you have a delay before requesting attach permission.

Another thing is that the timer will still be running next time you attach.

You have no timer stop or script reset.

 

Ah, yes. I should stop the timer. When the object (AFK sign above my head) is clicked, and detached, I forgot the timer would be running when attached again. Thanks.

 

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 4857 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...