Jump to content

Elevator/lift - disable call buttons


Tattooshop
 Share

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

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

Recommended Posts

Hey! making the elevator/lift with llSetKeyframedMotion. but if you press the button while moving, then the distance gets borkened. how to "disble buttons" while the elevator is moving? And yet, how to make it work for non-mesh objects linksets?

default
{
    touch_start(integer num)
    {
        integer button = llDetectedLinkNumber(0);
        {
            if (button == 2)
            {
                llSetLinkPrimitiveParamsFast(LINK_THIS, [PRIM_PHYSICS_SHAPE_TYPE, PRIM_PHYSICS_SHAPE_CONVEX]);
                llSetKeyframedMotion([ < 0, 0, 0 > , 3, < 0, 0, 0.5 > , 3, < 0, 0, 1 > , 3, < 0, 0, 1.5 > , 3, < 0, 0, 2 > , 3], [KFM_DATA, KFM_TRANSLATION, KFM_MODE, KFM_FORWARD]);
            }

            else if (button == 3)
            {
                llSetLinkPrimitiveParamsFast(LINK_THIS, [PRIM_PHYSICS_SHAPE_TYPE, PRIM_PHYSICS_SHAPE_CONVEX]);
                llSetKeyframedMotion([ < 0, 0, 0 > , 3, < 0, 0, -0.5 > , 3, < 0, 0, -1 > , 3, < 0, 0, -1.5 > , 3, < 0, 0, -2 > , 3], [KFM_DATA, KFM_TRANSLATION, KFM_MODE, KFM_FORWARD]);
            }
        }
    }
}

 

Edited by Tattooshop
Link to comment
Share on other sites

26 minutes ago, Rolig Loon said:

touch_start (integer num)
{
     if (!iTouched)
     {
          iTouched = TRUE;
          // Do stuff
     }
}

And then, when the elevator stops, set iTouched = FALSE.  (Be sure that iTouched is a global integer.)

Thank you! 😃

Well, here I made a mistake. After reaching the second floor, you can press up again ... and I do not need this at all!..  there will be only two floors. how to apply toggle here? is it possible?

integer iTouched = FALSE;

default
{
    touch_start(integer num)
    {
        if (!iTouched)
        {
            integer button = llDetectedLinkNumber(0);
            {
                if (button == 2)
                {
                    iTouched = TRUE;
                    llSetLinkPrimitiveParamsFast(LINK_THIS, [PRIM_PHYSICS_SHAPE_TYPE, PRIM_PHYSICS_SHAPE_CONVEX]);
                    llSetKeyframedMotion([ < 0, 0, 1 > , 3], [KFM_DATA, KFM_TRANSLATION, KFM_MODE, KFM_FORWARD]);
                    llSleep(3);
                    iTouched = FALSE;
                }

                else if (button == 3)
                {
                    iTouched = TRUE;
                    llSetLinkPrimitiveParamsFast(LINK_THIS, [PRIM_PHYSICS_SHAPE_TYPE, PRIM_PHYSICS_SHAPE_CONVEX]);
                    llSetKeyframedMotion([ < 0, 0, -1 >, 3], [KFM_DATA, KFM_TRANSLATION, KFM_MODE, KFM_FORWARD]);
                    llSleep(3);
                    iTouched = FALSE;
                }
            }
        }
    }
}

 

 

Edited by Tattooshop
Link to comment
Share on other sites

I got it! :) no separate buttons check but works!

integer iTouched = FALSE;
integer toggle;
default
{
    touch_start(integer num)
    {
        if (!iTouched)
        {
            integer button = llDetectedLinkNumber(0);
            {
                if (button == 2)
                {
                    toggle = !toggle;
                    if (toggle)
                    {
                        iTouched = TRUE;
                        llSetLinkPrimitiveParamsFast(LINK_THIS, [PRIM_PHYSICS_SHAPE_TYPE, PRIM_PHYSICS_SHAPE_CONVEX]);
                        llSetKeyframedMotion([ < 0, 0, 1 > , 3], [KFM_DATA, KFM_TRANSLATION, KFM_MODE, KFM_FORWARD]);
                        llSleep(3);
                        iTouched = FALSE;
                    }
                    else
                    {
                        iTouched = TRUE;
                        llSetLinkPrimitiveParamsFast(LINK_THIS, [PRIM_PHYSICS_SHAPE_TYPE, PRIM_PHYSICS_SHAPE_CONVEX]);
                        llSetKeyframedMotion([ < 0, 0, -1 > , 3], [KFM_DATA, KFM_TRANSLATION, KFM_MODE, KFM_FORWARD]);
                        llSleep(3);
                        iTouched = FALSE;
                    }
                }
            }
        }
    }
}

 

  • Like 2
Link to comment
Share on other sites

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