I'm working on creating an estim based script and I've been running into a problem where a random piece of audio, about a 1 second chunk will continue to repeat over and over again even after issuing a playBackgroundSound(null);
Basically my script is presenting a text input, then compares the text that was typed with the input it is expecting and if they don't match or the person is too slow to give a response, it will play one type of audio file. If it is correct, it will play a different audio file.
Basically like this, my actual text and filenames are different, I've changed things here to not spoil what I'm trying to do, although it's a bit predictable anyway.
Code:
if (expectedinput==typed) {setImage("example/example.jpg"); playBackgroundSound(null); playBackgroundSound("StimPack/pleasure/"+(110+getRandom(49))+".mp3"); text="Insert words here"; } else {setImage("example/scold123.jpg"); text="Wrong"; playBackgroundSound("StimPack/pain/ouchfile.mp3"); }
if (end-start>timelimit) {text=text+", your response is too slow, pain time for you";}
playBackgroundSound(null); playBackgroundSound("StimPack/pain/ouchfile.mp3"); }
What confuses me is I have played all of the rest of the estim based scripts here haven't ended up with a 'hanging chunk' of sound but it seems it keeps repeating the same 1 second chunk again and again, it doesn't stop if I restart the script or even start a different script. It seems to continue until I completely close Sexscripts. Since this is supposed to mostly be a pleasurable estim script, it gets a little rough when the sounds bite that keeps repeating combines with the next file that plays. Is there anything I'm missing with my code? It seems to work for maybe 50 different start/stops of different audio files before I run into the problem and all of the audio files are 20 seconds long.