MV [SOLVED] How to use a variable in a filename?

Issue:
I have 8 different footstep sounds, that I want to be played random.
Currently, this is my setup:

1711558523759.png

I created a random variable and for every possible outcome I have a specific sound effect.
It works, but its a lot of lines - and because the whole event will be much longer in the end, I want to shorten this part as much as I can.


What I want:
a line of JS-Code that basically says
AudioManager.playSe({name: 'fst_cnc_x',})
And x shall be the variable "varRandomFST" from above

But because of my very limited JS-knowledge I have no Idea how to do it ^^"
It's AudioManager.playSe({name: 'fst_cnc_0' + $gameVariables.value(4)}, ...); (since that variable seems to have an ID of 4).
Or just generate a random number directly in there with Math.floor(Math.random() * 8) + 1
Also, if your numbers go into the double-digits, the core scripts have a Number#padZero method, e.g.
JavaScript:
"fst_cnc_" + (Math.randomInt(8) + 1).padZero(2)
Math.floor(Math.random() * 8) + 1
This could be shortened to Math.randomInt(8) + 1
You can try this by itself - random file select between the 8 files with a slight volume variation between 35 and 40 as well as a pitch variation between 97% and 102%. You can make the range smaller if it sounds too different.
JavaScript:
if ($gamePlayer.isMoving()) {
    AudioManager.playSe({
        name: "fst_cnc_0" + (Math.randomInt(8) + 1),
        volume: 35 + Math.randomInt(6),
        pitch: 97 + Math.randomInt(6)
    }); this.wait(30);
}

Edit: if this is in parallel, I would add a wait frame command in addition to the script call above as well so that the event is not trying to run 60+ times each frame (tweak as needed).
Thank you all. Now I have it short and clean.
And a little bit more JS-Knowledge xD

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/solved-how-to-use-a-variable-in-a-filename.167215/