I cannot upload the screenshots today, so I'll just write everything.
What I want to do:
I have 3 musics for my current scene. I want to play them randomly, and I want a random silence between each.
I try to do it with actions betcause I make too many mistakes with code.
Problem:
When 1 of the 3 musics is loaded as the new background music, it loops endlessly and the other musics never play.
What I did:
I have created a variable named "choose_music" that randomly takes values between 1 and 3.
I have created another variable named "delay" that takes a random value between 10 and 120, in order to define the length of the silence.
Script1: Called by other action if value 'choose_music' = 1
change background music of scene 'Current scene' to 'music1.ogg'
wait until sound 'music1.ogg' is finished
pause for 'delay" seconds
end if
if value 'choose_music' = 2
change background music of scene 'Current scene' to 'music2.ogg'
wait until sound 'music2.ogg' is finished
pause for 'delay" seconds
end if
if value 'choose_music' = 3
change background music of scene 'Current scene' to 'music3.ogg'
wait until sound 'music3.ogg' is finished
wait until sound stinger2.ogg is finished
end if
Jump to action part #1
Script2: At beginning of the sceneThis script loads Script1 and makes a loop, in order to call the script all the time and refresh the background music when it is finished.
I have created a condition 'loop_music' in order to break the loop later.
if condition 'loop_music' is true
pause for 1 second
call action 'Script1' -- above
pause for 1 second -- just to be sure
jump to action part #1
end if
Script3: At end of sceneThis script breaks the loop in Script2
Change condition 'loop_music' to false
That's all I have kept right now. I have tried a lot of different actions in different orders, but it never worked. I hope you see what I'm trying to do. Thanks for your help!