Hello,
I’m trying to get this code working on pavlovia, but apparently I need to change it into a JS code first.
In this routine, I’ve randomised the sound between mute 0 and sound 1. I have done this on the builder view using the custom code (inserting python commands to the experiment)
the code I had converted to JS as well so I can upload the experiment on Pavlovia is not working - stuck on initailising
The experiment works perfectly on locally but not online
example, CODE 3 - sound randomisation
soundFlag = randint(1,10)
if soundFlag < 6:
soundFlag = 0
else:
soundFlag = 1
sound_5.setVolume(soundFlag, log=False)
And the JS equivalent
function getRandInt(min, max) {
min = Math.ceil(min);
max = Math.floor(max);
return Math.floor(Math.random() * (max - min + 1)) + min;
}
soundFlag=getRandInt(1,10);
if(soundFlag<6){
soundFlag=0;
}
else{
soundFlag=1;
}
Wait Time
waitTime=getRandInt(2,8);
waitTime=waitTime/10;
But it is not working
Link is https://run.pavlovia.org/smoha005/sfm_tffm/html/