Jump to content

Want to create music player script


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

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

Recommended Posts

Hello! I need to create a script that allows to loop a 10 seconds sound clip from the UUIDs list in the script (or one notecard). and to switch to the next loop when clicked, (please, note - not full song player - only one 10 seconds loop) with the ability to turn on / off.

any suggestions?

Scheme, how i see it:

start

list:

bananas - uuid1, vol 1.0;

madonna - uuid2, vol 1.0;

...

jackson - uuid3, vol 1.0;

on/off ?;

if touched loop next uuid;

end.

Yes, I already asked and really hate to do this, but now I decided to try to create my own script, because I did not find a suitable one from the existing ones.

Edited by ainst Composer
Link to post
Share on other sites

Something like... (untested)

integer count;
list songs = [uuid#1, uuid#2, etc etc];
default
{
    touch_start(integer total_number)
    {   llLoopSound( llList2Key(sounds,count), 0.5 );
        ++count;     

     count %= llGetListLength(sounds);
    }
}

Edited by Xiija
  • Thanks 1
Link to post
Share on other sites
1 hour ago, Xiija said:

Something like... (untested)

integer count;
list songs = [uuid#1, uuid#2, etc etc];
default
{
    touch_start(integer total_number)
    {   llLoopSound( llList2Key(sounds,count), 0.5 );
        ++count;     

     count %= llGetListLength(sounds);
    }
} 

Thanks very much for your answer! You are awesome!


integer count;
list songs = [
"6aa62a53-b504-ac84-f045-c635872487ce", 
"79e5c392-acf3-94fe-a311-47bdff2cb511", 
"0ff6b5fd-ae86-6980-8bfa-38a93dadd2ab"];
default
{
    touch_start(integer total_number)
    {   llLoopSound( llList2Key(songs,count), 0.5 );
        ++count;     

     count %= llGetListLength(songs);
    }
} 

(Its an example UUIDs)

Edited by ainst Composer
Link to post
Share on other sites

A basic toggle switch just needs a global integer variable that you can use as a Boolean TRUE/FALSE, or ON/OFF switch. Change its polarity every time that you trigger the event that it's in (like your touch_start event) and then take a different action depending on whether your variable is TRUE or FALSE at the time.

As for a long press, there are several ways to do that.  I suggest looking at the LSL wiki entry for llGetTime for inspiration.  Think about the possibility of using a touch_end event as well as a touch_start event, for example.

  • Thanks 1
Link to post
Share on other sites
You are about to reply to a thread that has been inactive for 745 days.

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...