Jump to content

autoanchor [lock avi possition or no push] is it possible to make this work with touch_start?


JDroo
 Share

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

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

Recommended Posts

vector gPos;
integer gAnchored = FALSE;
 
default
{
    state_entry()
    {
        llListen(0,"",llGetOwner(),"");
        gPos = llGetPos();
    }
    touch_start(total number)
    {
        if (agent != NULL_KEY)
        {
            llRequestPermissions(agent, PERMISSION_TAKE_CONTROLS);
        }
        else
        {
            llReleaseControls();
        }
    }
 
    run_time_permissions(integer perm)
    {
        if (perm)
        {
            llTakeControls(CONTROL_DOWN| CONTROL_FWD| CONTROL_UP | CONTROL_LEFT | CONTROL_RIGHT | CONTROL_BACK, TRUE, TRUE);
        }
    }
    control(key id, integer level, integer edge)
    {
        if (level > 0)
        {
            llStopMoveToTarget();
        }
        else
        {
            gAnchored = TRUE;
            gPos = llGetPos();
            llSetStatus(STATUS_PHYSICS, TRUE);
            llMoveToTarget(gPos,0.1);
        }
    }   
}
 

 hihi this script works nice and all, but is it possible to make it turn off and on on the touch of the prim?? help :o

 

Link to comment
Share on other sites

You could do it easily by modifying the somewhat meaningless if test that's in the touch_start event already.  Use a new global variable gON as your On/Off switch.  (Put integer gON; at the top of your script. )  Then rewrite touch_start  as

touch_start(total number){    gON = !gON;  //Reverse the sense of the switch    if (gON)    {        if (llGetPermissions() & PERMISSION_TAKE_CONTROLS)        {            llTakeControls(CONTROL_DOWN| CONTROL_FWD| CONTROL_UP | CONTROL_LEFT | CONTROL_RIGHT | CONTROL_BACK, TRUE, TRUE);        }        else        {            llRequestPermissions(llDetectedKey(0), PERMISSION_TAKE_CONTROLS);        }    }    else    {        llReleaseControls();    }}

 

 

Link to comment
Share on other sites

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