Jump to content

Automagic Feet Changer for Maitreya Body


Mollymews
 Share

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

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

Recommended Posts

this a little helper attachment script for changing our Maitreya feet so we don't have to press HUD buttons to do this when we change our outfits, and our shoes are not scripted to do it for us

 

// Automagic Feet Changer for Maitreya Body
//
// public domain
//
// follow the instructions in the Maitreya Mesh Body - Feet Auto-Select V5 kit
//   to put script: Maitreya Feet Auto-Select V5
//   and notecard: Maitreya Feet Auto-Select V5 Confiq (with appropriate feet setting)
//   into a prim, along with this script
//
// name the prim similar to the feet setting. Like for example
//    Automagic Maitreya Flat Feet
//    Automagic Maitreya High Feet
//
// make one prim attachment for each feet style
//
// attach the prim to yourself
//
// the intent of this is to be able to include this prim as an attachment
//    in a outfit saved in My Outfits. So that when we change our outfit
//    our feet change automagically to the feet style wanted
//
// Note: We could just wear the Maitreya Feet Auto-Select V5 script by itself
//    but the idea here is to not wear scripts unnecessarily for  longer than
//    we need too, and also not have to press HUD buttons to change our feet


// name of our maitreya body. Change to whichever
string MAITREYA_BODY = "Maitreya Mesh Body - Lara V5.3";

integer ticks;  // timer tick counter

default
{
    attach(key id)
    {
        if (id)  
        {   // initialise
            // set timer off, if it isn't already. Reset timer ticks to 0
            llSetTimerEvent(0.0);
            ticks = 0;
            // then request permission for subsequent action and finally auto-detach
            llRequestPermissions(id, PERMISSION_ATTACH);
        }
    }
    
    run_time_permissions(integer perm)
    {
        if(perm & PERMISSION_ATTACH)
        {
            // start the timer to (poll) find if the Maitreya Body is attached
            // poll every 1 second
            llSetTimerEvent(1.0);
        }
    }
    
    timer()
    {
        // when Maitreya Body found, give companion script Maitreya Feet Auto-Select V5.1
        // plenty of time to do its job, and then detach ourself       
        list attachments = llGetAttachedList(llGetPermissionsKey());
        integer index = -llGetListLength(attachments);
        while(index++)
        {
            if (llList2String(llGetObjectDetails(llList2Key(attachments, index), [OBJECT_NAME]), 0) == MAITREYA_BODY)
            {
                // maitreya body is attached
                // sleep for 1 minute to give companion script plenty of time to do its job
                llSetTimerEvent(0.0);
                llSleep(60.0);
                // then detach self
                if(llGetPermissions() & PERMISSION_ATTACH)
                {
                    llDetachFromAvatar();
                }
                return;  // break
            }
        }
        // when body is not yet found then we look again on next timer
        // after a minute (60 searches) we assume that the body is not attached and detach ourself        
        if (++ticks == 60)
        {
            if(llGetPermissions() & PERMISSION_ATTACH)
            {
                llDetachFromAvatar();
            }
        }
    }
}

 

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

had some feedback on this.  Polling 60 times is a bit overkill, given that its about length of time attached. So changed the polling to 6 times, while keeping to the 1 minute minimum  time attached

// Automagic Feet Changer for Maitreya Body
//
// mod. tidy up polling
//
// public domain
//
// follow the instructions in the Maitreya Mesh Body - Feet Auto-Select V5 kit
//   to put script: Maitreya Feet Auto-Select V5
//   and notecard: Maitreya Feet Auto-Select V5 Confiq
//   into a prim, along with this script

// attach the prim to yourself
//
// the intent of this is to be able to include this prim as an attachment
//    in a outfit saved in My Outfits. So that when we change our outfit
//    our feet change automagically to the feet style wanted
//
// name the prim similar to the feet setting. Like for example
//    Maitreya Flat Feet
//    Maitreya High Feet
//
// make one prim attachment for each feet style
//
// Note: We could just wear the Maitreya Feet Auto-Select V5 script by itself
//    but the idea here is to not wear scripts unnecessarily for  longer than
//    we need too and not have to press HUD buttons to change our feet


// name of our maitreya body. Change to whichever
string MAITREYA_BODY = "Maitreya Mesh Body - Lara V5.3";


default
{
    attach(key id)
    {
        if (id)  
        {   // initialise
            // set timer off, if it isn't already
            llSetTimerEvent(0.0);
            // then request permission for subsequent action and auto-detach
            llRequestPermissions(id, PERMISSION_ATTACH);
        }
    }
    
    run_time_permissions(integer perm)
    {
        if(perm & PERMISSION_ATTACH)
        {
            // start the timer to (poll) find if the Maitreya Body is attached
            // poll every 10 seconds. In most instances companion script will have already done its job
            //   within 10 seconds
            llResetTime();
            llSetTimerEvent(10.0);
        }
    }
    
    timer()
    {
        // when Maitreya Body found, give companion script Maitreya Feet Auto-Select V5.1
        // plenty of time to do its job, and then detach ourself       
        list attachments = llGetAttachedList(llGetPermissionsKey());
        integer index = -llGetListLength(attachments);
        while(index++)
        {
            if (llList2String(llGetObjectDetails(llList2Key(attachments, index), [OBJECT_NAME]), 0) == MAITREYA_BODY)
            {
                // maitreya body is attached
                // sleep for 1 minute more to give companion script plenty of time to do its job if it hasn't already
                // 1 minute more also gives us time to add to Outfit and Save/SaveAs before it detaches
                llSetTimerEvent(0.0);
                llSleep(60.0);
                // then detach self
                if(llGetPermissions() & PERMISSION_ATTACH)
                {
                   llDetachFromAvatar();
                }
                return;  // break
            }
        }
        // when body is not yet found then we look again on next timer
        // after a minute (6 polls) we assume that the body is not attached and detach ourself        
        if (llGetTime() >= 60.0)
        {
            if(llGetPermissions() & PERMISSION_ATTACH)
            {
               llDetachFromAvatar();
            }
        }
    }
}

 

 

Edited by Mollymews
posted wrong mod
  • Like 1
  • Thanks 2
Link to comment
Share on other sites

16 minutes ago, Emma Krokus said:

All those no mod shoes can now have this little thingie in the folder and no more hunting for the Maitreya HUD to set the foot pose.

 

was so annoying before. About half my outfits are flat feet and the other half higher.  Change my outfit and don't check my feet. Walking round for about half an hour til I notice my heels floating beneath my flat feet, or my toes sticking out the bottom of my kicks.  Shame !!!

so went down this way, which turned out pretty ok for me. So I thought I can't be the only person wandering about with shame feet on! So I posted it on here

am pretty happy that has turned out ok for you too :)

 

 

  • Haha 1
Link to comment
Share on other sites

1 minute ago, Mollymews said:

 

was so annoying before. About half my outfits are flat feet and the other half higher.  Change my outfit and don't check my feet. Walking round for about half an hour til I notice my heels floating beneath my flat feet, or my toes sticking out the bottom of my kicks.  Shame !!!

so went down this way, which turned out pretty ok for me. So I thought I can't be the only person wandering about with shame feet on! So I posted it on here

am pretty happy that has turned out ok for you too :)

 

 

so thats not just me??!!!!!!!!!!!!!!!!!!

hahahaha

your little script means I now don't have to bother with adding the HUD to the outfit folder (and remember to detach it) - so less lag :) 

  • Haha 1
Link to comment
Share on other sites

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