Jump to content

Reset Multiple Scripts in Primset


EnCore Mayne
 Share

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

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

Recommended Posts

i have a primset HUD that i'd like to be able to reset all the scripts on touch of a button on the HUD. any hints?

i've tried an llResetScript() but as soon as it fires, the root's script resets but all the others are left unreset.

if i understand llResetOtherScript() properly, that only resets scripts in the root. these other scripts are spread out throughout the primset.

Link to comment
Share on other sites

Use llMessageLinked to send a command to your child prims and execute llResetScript.

Now IF the prim should hold more than one script, your can solve it by doing as below:

resetOtherScripts()
{
    string strName;
    integer l = llGetInventoryNumber( INVENTORY_SCRIPT );
    integer i;
    for( i = 0; i < l; i++ )
    {
        strName= llGetInventoryName( INVENTORY_SCRIPT, i );
        if(  strName!= llGetScriptName() ){
            llResetOtherScript( strName );
        }
    }
}

  • Like 3
Link to comment
Share on other sites

I use the method that Rachel described all the time.  In objects that contain many scripts, it may be wise to restart them one at a time instead of doing them all together.  In that case, just build the restarts into a timer:

integer giCount;
integer giNumScripts;

default
{
    link_message(integer from, integer iCode, string message, key id)
    {
        if (message == "RESTART")
        {
            giNumScripts = llGetInventoryNumber(INVENTORY_SCRIPT);
            giCount = 0;
            llSetTimerEvent(0.2);
        }
    }
    timer()
    {
        if (giCount < giNumScripts)
        {
            if (llGetInventoryName(INVENTORY_SCRIPT,giCount) != llGetScriptName())
            {
                llResetOtherScript(llGetInventoryName(INVENTORY_SCRIPT,giCount));
            }
            ++giCount;
        }
        else
        {
            llSetTimerEvent(0.0);
        }
    }
}


   

  • Like 2
Link to comment
Share on other sites

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