Monday, April 3, 2017

Movelock Script

[ad_1]

integer attached = FALSE;

integer key_pressed = FALSE;

integer movement_locked = FALSE;

vector lock_position = ZERO_VECTOR;


lock()


    movement_locked = TRUE;

    lock_position = llGetPos();

    llMoveToTarget(lock_position, 0.05);

    llSetVehicleType(VEHICLE_TYPE_SLED);

    llSetVehicleVectorParam(VEHICLE_LINEAR_FRICTION_TIMESCALE, Wink;



unlock()


    movement_locked = FALSE;

    

    llStopMoveToTarget();

    llSetVehicleType(VEHICLE_TYPE_NONE);



move_lock()


    if (!attached) return;

    vector velocity = llGetVel();

    integer agent_info = llGetAgentInfo(llGetOwner());

    integer is_flying = ((agent_info & AGENT_FLYING) != 0);

    integer is_falling = ((agent_info & AGENT_IN_AIR) != 0) && !is_flying;

    string animation = llGetAnimation(llGetOwner());

    

    if (movement_locked)

    key_pressed

    else

   

        

        if ((agent_info & AGENT_SITTING) == 0 && animation != "Animation name here")

       

   



initialize()


    llOwnerSay("is starting...");

    

    attached = TRUE;

    

    llRequestPermissions(llGetOwner(), PERMISSION_TAKE_CONTROLS);



finalize()


    attached = FALSE;

    

    llReleaseControls();

    llSetTimerEvent(0.0);

    

    unlock();

    

    llOwnerSay("is offline...");



default


    state_entry()

   

        if (llGetAttached() != 0)

       

            initialize();

       

   

    

    on_rez(integer sparam)

   


        if (llGetAttached() == 0)

       

            finalize();

       

   

    

    attach(key id)

   

        

        if (id != NULL_KEY)

       

            initialize();

       

        else

       

            finalize();

       

   

    

    run_time_permissions(integer perms)

   

        if ((perms & PERMISSION_TAKE_CONTROLS) != 0)

        CONTROL_BACK

   

    

    control(key id, integer level, integer edge)

   

        if (level != 0)

       

            if (!key_pressed)

           

                key_pressed = TRUE;

                

                

                llSetTimerEvent(0.0);

                llMinEventDelay(0.2);

                unlock();

           

       

        else

       

            if (key_pressed)

           

                key_pressed = FALSE;

                

                llSetTimerEvent(0.2);

                llMinEventDelay(0.0);

                

                move_lock();

           

       

   

    

    timer()

   

        move_lock();

   

[ad_2]

Download from Source link

No comments:

Post a Comment