|
Haplo Voss
Registered User
Join date: 18 Nov 2006
Posts: 137
|
02-25-2007 22:10
Hi all, I would really appreciate some debugging help here. I have no idea where I have gone wrong as it worked fine one minute, now it doesn't work. I'm banging my head against the wall and am sure it's something simple, or it's just completely wrong all together. First, understand I am a beginner, but I want to learn from scratch and not just cut and paste until I get "my own" patchwork. Second, assume all the songs contained in the object are Song_name1, etc. in these groups: Song_name1-6, Song_name1-6, Song_name1-19, Song_name1-16 Now then: integer track; integer last_track; default { state_entry() { llListen(2011,"","",""); } //Ok - I'm listening for the touch on the item here... touch_start(integer num) { llDialog(llDetectedKey(0),"Play which song?",["Song1_name","Song2_name","Song3_name","Song4_name"],2011); } //Now I'm listening for the menu choice here right? listen(integer channel, string name, key id, string message) { if (message == "Song1_name") {track = 0; last_track = 5;} if (message == "Song2_name") {track = 31; last_track = 43;} if (message == "Song3_name") {track = 6; last_track = 11;} if (message == "Song4_name") {track = 12; last_track = 30;} //Now then, they've made their choice, track SHOULD be position in INVENTORY_SOUND list am I right? //I've manually counted out what last_track is in the list where the playlist should stop. //Here is where it gets ugly: while (track<=last_track) //straightforward enough { llPreloadSound(llGetInventoryName(INVENTORY_SOUND, track)); llPlaySound(llGetInventoryName(INVENTORY_SOUND, track), 1); llSleep(6.8); //since there is a preload it adds a second, so I'm pausing 7.8 seconds - average file is 8 or less secs. llStopSound();// I only put this here because it's blowing my mind and thought I'd try it. track += 1;//As far as I know this is a no-brainer... please increase x by one }// now go back and do it again until track adds up to last_track }// now close out theDialogue script }// now close out the whole banana.
My results are that I am getting double events. Sounds playing on top of one another anywhere from 1 second to an entire sound apart. Sometimes its even a different "song" playing together. I don't get it. To me, a variable can only contain one value, and a command can only execute once with one variable at a time, especially with a sleep timer (which is why I wrote it this way as a beginner - no possible fouls) Yet here I am with no explanations for me. THANK YOU!!! Haplo
|
|
Haplo Voss
Registered User
Join date: 18 Nov 2006
Posts: 137
|
02-25-2007 22:27
By the way, the sounds playing on top of each other can be from totally different areas, as in different 'songs' as if I were playing 2 tracks say 1 and 14 simultaneously. Weirdness. At least to me at this point. Thanks in advance! 
|
|
Haplo Voss
Registered User
Join date: 18 Nov 2006
Posts: 137
|
02-25-2007 23:13
OK well it may be a glitch on my end. I commented out ALL playsound items just for grins - guess what? IT STILL PLAYED THE MUSIC!
SO I DELETED ALL the music files from the object. IT STILL PLAYED THE MUSIC
I created a new object. dropped in the script. IT STILL PLAYED THE MUSIC with NO sound files in the object.
WAHT IS GOING ON HERE? Can anyone tell me? Is there some sort of buffer I've messed up?
Thanks, Haplo
|
|
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
|
02-26-2007 00:21
Check there isnt a 'hidden' object with the scripts still in?
|
|
Haplo Voss
Registered User
Join date: 18 Nov 2006
Posts: 137
|
Doh!
02-26-2007 02:02
Thank you! I had another object that I was using for a test just to the side. I didn't reeealize that clicking on one, would also activate the other one. I put the other one in inventory and left only the one out in the open to work on. Presto, no more problem. Thanks for the input. Now I just need to work on my stop script. I added the "stop" script at the end. No problem. Gotta figure out the command structure within the loop to exit to the "stop" I wrote.  Thank youagain!! DOH!  Haplo
|
|
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
|
02-26-2007 04:56
From: Haplo Voss Thank you! I had another object that I was using for a test just to the side. I didn't reeealize that clicking on one, would also activate the other one. I put the other one in inventory and left only the one out in the open to work on. Presto, no more problem. Thanks for the input. Now I just need to work on my stop script. I added the "stop" script at the end. No problem. Gotta figure out the command structure within the loop to exit to the "stop" I wrote.  Thank youagain!! DOH!  Haplo The problem was you had a hard coded channel number 2011. try to NEVER use them unless you really have to!
|
|
Haplo Voss
Registered User
Join date: 18 Nov 2006
Posts: 137
|
02-26-2007 05:08
From: Newgate Ludd The problem was you had a hard coded channel number 2011. try to NEVER use them unless you really have to! I see hardcoded channels all the time in scripts I've seen. Usually either negative or positive but sometimes whacky numbers too which I'm sure is for security. Is there a good random number generator script I can write for that? Plus... since I make instruments, I'm hoping to be able to create "bands" in the future so that people can play together. That being the case I WOULD have those people come back to me and change their scripts on different instruments to all the same channel right? (Still working on an animation ball that would controll everyone together for something like that.) Thanks!!
|
|
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
|
02-26-2007 05:29
In something where you need collaborative effort then hard coded numbers are ok, BUT its still best to have them dynamically assigned, i.e. from a notecard or the object description. That way the if fred goes to another band he just edits the description field (for instance) of his guitar to the new common channel. Personally I use the following code to assign dialog and non linked channels. CHANNEL = 0 - (integer)llFrand(2147483647);
For linked I either put the data into a notecard or into the description. Quick hint for you concerning multiple person poses, look at the solop Dance machine, its a freebie that is used by 99% of dance balls. It basically consists of a master control script and then a number of slaved scripts. Each script controls a different AV and follow what the master script tells them. Would be very easy to adapt to your purposes. In fact I'm currently scripting something very similar for a teacher / Student yoga mat. HtH
|