All pastes #507908 Raw Edit

For Rusties

public text v1 · immutable
·published 2007-05-24 20:01 UTC
rendered paste body
list invlist;
integer tottrack;
integer i;
integer playing = 0;
integer clips; 
float clip_length = 9.9;//in seconds
default
{
    state_entry()
    {
        playing = 1;
        llTargetOmega(<0,0,0>,PI,0);
        
        llSetSoundQueueing(FALSE);
        llStopSound();
        llOwnerSay("Loading clip 1 please wait.");
        llSetSoundQueueing(TRUE);
        clips = llGetInventoryNumber(INVENTORY_SOUND);
        llPreloadSound(llGetInventoryName(INVENTORY_SOUND,0));
        llSleep(clip_length/2);
        llOwnerSay("Touch to start.");
        playing = 0;
    }
    
    on_rez(integer start_param)
    {
        llResetScript();
    }
    
    touch_start(integer total_number)
    {
        if (llDetectedKey(0) == llGetOwner())
        {
            if(playing == 0)
            {
                playing = 1;
                llTargetOmega(<0,0,.2>,PI,1.0);
                llSetTimerEvent(10);//Set the time(in seconds) seperated
                tottrack = llGetInventoryNumber(INVENTORY_SOUND);
                float length = tottrack*9.9;
                llSetText("Nakaido 'Chabo' Reichi - Lain's Theme (Reprise)", <1, 0, 0>, 1);//Change the quotes to have the name of the song and artist over the object
                llSay(0, (string)(llFloor(length)) + " seconds long");
                llPreloadSound(llGetInventoryName(INVENTORY_SOUND, 0));
            }
            else
            {
                playing = 0;
                llSay(0,"Stopping...");
                llTargetOmega(<0,0,0>,PI,0);
                llStopSound();
                llResetScript();
            }
        }
    }
    
    timer()
    {
        llTriggerSound(llGetInventoryName(INVENTORY_SOUND, i++), 10);
        
        if(i < tottrack )
        {
            llPreloadSound(llGetInventoryName(INVENTORY_SOUND, i));
            
        }
        else
            i = 0;
    }
}