Hi everyone!!!! Thinking about my problem of How to make a charset preview? thread, i read the JS Snippets Thread when something sparked my interest: Jonforum said: This snippet allow you to: List all files and folders in a directory with Node.js
Hi everyone!!!!
Thinking about my problem of
How to make a charset preview? thread, i read the
JS Snippets Thread when something sparked my interest:
This snippet allow you to: List all files and folders in a directory with Node.js
PHP:
var walkSync = function(dir, list) {
var path = path || require('path');
var fs = fs || require('fs'), files = fs.readdirSync(dir), list = list || [];
files.forEach(function(file) { // create instance for eatch folder
if (fs.statSync(path.join(dir, file)).isDirectory()) {
list = walkSync(path.join(dir, file), list);
}
else { list.push(path.join(dir, file)) };
});
return list;
};
example
PHP:
var walkSync = function(dir, list) {
var path = path || require('path');
var fs = fs || require('fs'), files = fs.readdirSync(dir), list = list || [];
files.forEach(function(file) { // create instance for eatch folder
if (fs.statSync(path.join(dir, file)).isDirectory()) {
list = walkSync(path.join(dir, file), list);
}
else { list.push(path.join(dir, file)) };
});
return list;
};
const result = walkSync("SSA"); // scan folder named "SSA"
This snippet of JonForum is not exactly what I am looking for, but I don't really need to see the NodeJs or anything. The script i need shall be able to work in game...
Is it possible to make the list out of the \img\characters folder of the game?
Of course, this is for preview, it won't be working in the final project as it is very excessive.
The idea would be to iterate over the objects of the list, which would be the different file names, being able to see them in the game preview in order to check if they are correct or not.
Without iteration, the character preview would be very harsh to make.
The
small script must be able to be located inside a Set Movement route command.