Hi everyone 🙂
Thanks in advance for any help.
I'm wondering if there's a script or script call I can use to check the number of files inside a folder?... As in return into a variable the number of files in /img/pictures for example...
This'll give you the amount of images loaded in the image cache so you could filter the result by the folder path
Object.keys(ImageManager._imageCache._items).length
Thanks ATT_Turan! That's exactly what I need, tested and it works, however I have another question.
In your example you have this - const dir = "./img/pictures";
Which in my case is this - const dir = "./img/pictures/Alaska/Beach";
If I enter that it works just fine, however I want the word "Alaska" to come from a variable e.g. (Mexico, US, France)
I tried - const dir = "./img/pictures/" + $gameVariables.value (1) + "/Beach";
That didn't work.
This didn't work either -
gameVariables.setValue(8, $gameVariables.value(6) + $gameVariables.value(21) + $gameVariables.value(7));
- It returns ./img/pictures/Alaska/Beach without the quotes of course, and if I use '"./img/pictures/' to include the double quotes it just crashes.
Any advice?
Thanks in advance
I'll try that and let you know.
Thanks 🙂
Yeah! That worked awesome!!! Everything is prefect now!
Thank you so much!
Please note that this will not work if you deploy to web browsers. Just something to keep in mind.