Hello!
Since I would like to start playing D&D, and also want to make things easier for me in the long run, I’m planning on making an item creator.
The code I have so far allows me to write out an item, and save the data to a text file, for example “Rusty Sword.txt”.
Now I want to make a program that helps me to convert a batch of the previously created files into png files. But first, I’ll have to load the objects into my program. This is as far as I got:
import java.util.Date;
String path;
File[] files;
File f;
String[][] list;
int var = 0;
void setup() {
path = sketchPath();
files = listFiles(path);
for (int i = 0; i < files.length; i++) {
f = files[i];
list = new String[files.length][10];
list[i] = match(f.getName(), “.txt”);
if (list[i] != null) {
for (int b = 0; b < list.length; b++) {
list[b] = loadStrings(f.getName());
for (int a = 0; a < list[b].length; a++)if(var < files.length)println(list[b][a]);
}
}
}
exit();
}
Now, it does what is supposed to. Kind of. The main problem I’m having is that the code as it is now prints my files to the console exactly as often as I have files in my root folder. If I have three files in there, it will print my Strings five times, as it will do so for the data folder, the applet itself, and the actual text files I want to convert.
I know that this is because of my for loops being stuck inside each other, but I just can’t wrap my head around how to to it -just- once, or how to even get my code to work in any other form that what I have now.
Does anyone have any ideas? I’m looking forward to your answers.
Pstscrpt: Sorry if my formatting is off, this my first post, because I just really wanna get past this road block in my head.