Jump to content

Creating a Music box receiving Errors


Crys Staryk
 Share

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

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

Recommended Posts

Good morning all,

I am trying to create a music box.

I am trying to use a touch to open script along with a play music on touch script.  When I touch the prim used for the lid it opens then I get an error message saying cannot find sound followed by the music playing correctly.  Not sure why it's giving me the error or how to correct it.

 

Thank you for any assistance you can provide,

Crys

Link to comment
Share on other sites

This is the script i'm using

 

//

list myList= [];
integer preloadfile;
float volume;
integer totalfiles;
integer ison;

default
{
    state_entry()
    {
        ison=FALSE;
        llStopSound();
           //llSetSoundQueueing(TRUE);
                       integer i=0;
         while (i<llGetInventoryNumber(INVENTORY_SOUND))
         {
             myList = myList + [llGetInventoryName(INVENTORY_SOUND,i)];
             i++;
            }
    }
    touch_start(integer total_number)
    {    
    totalfiles = llGetListLength(myList);
    if(ison==TRUE)
    {
          llSetTimerEvent(0);
    llStopSound();
    ison = FALSE;
}
else
{
    ison=TRUE;
        preloadfile = 0;
         volume = 1.0;
        llSetSoundQueueing(FALSE);
        llPreloadSound(llList2String(myList,preloadfile));
        llPreloadSound(llList2String(myList,preloadfile+1));
        llSleep(2);
         llPlaySound(llList2String(myList,preloadfile), volume); 
        llSetTimerEvent((float)llGetSubString(llList2String(myList,preloadfile), -7, -4));
                preloadfile += 1;
          

         //  llMessageLinked(LINK_ALL_OTHERS, 0, "on", llDetectedKey(0));
}
}
timer()
{
             
    llPlaySound(llList2String(myList,preloadfile), volume); 
    llSetTimerEvent((float)llGetSubString(llList2String(myList,preloadfile), -7, -4));
            preloadfile += 1;
            if(preloadfile==totalfiles)
            {
                preloadfile = 0;
            }
            llPreloadSound(llList2String(myList,preloadfile));
        }
      changed(integer change)
    {
        if(change & CHANGED_INVENTORY)
        {
            llResetScript();
        }
    }
    on_rez(integer param)
    {
        llResetScript();
    }
}

Link to comment
Share on other sites

I think you will find that one of your llPreloadSound statements is trying to read past the end of myList.  I suggest adding a few strategically-placed llOwnerSay statements to find out what sound file it is trying to load in each of those spots.   BTW, the llStopSound statement in your touch_start event will have no effect.  That function only applies to looped sounds.

Link to comment
Share on other sites

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