ainst Composer Posted April 5, 2019 Share Posted April 5, 2019 (edited) 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 April 5, 2019 by ainst Composer Link to comment Share on other sites More sharing options...
Xiija Posted April 5, 2019 Share Posted April 5, 2019 (edited) 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 April 5, 2019 by Xiija 1 Link to comment Share on other sites More sharing options...
steph Arnott Posted April 5, 2019 Share Posted April 5, 2019 https://www.outworldz.com/cgi/freescripts.plx?ID=548 2 Link to comment Share on other sites More sharing options...
ainst Composer Posted April 5, 2019 Author Share Posted April 5, 2019 (edited) 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 April 5, 2019 by ainst Composer Link to comment Share on other sites More sharing options...
ainst Composer Posted April 5, 2019 Author Share Posted April 5, 2019 Maybe someone knows how to add on and off here? what are the ways? The chat command is more or less clear, but how else? Say, a long press for three seconds? how to do it? Link to comment Share on other sites More sharing options...
Rolig Loon Posted April 5, 2019 Share Posted April 5, 2019 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. 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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