So I've scoured the internet for a fix, and i've gotten tips to use maps, the reflect method, and a ton of other stuff, but nothing has worked the way I wanted.
My goal is to do something like this:
I have a string divided into an array. Example: "setVal strength 3"
lineArray[0] = setVal
lineArray[1] = strength
lineArray[2] = 3
I want to take lineArray[1] and add "Feats." to the beginning of it, so it it, for example, something like "Feats.strength" (which I can do with a string variable)
I then want to set that variable (Feats.strength, it's a double called strength in the Feats class) to lineArray[2] (which is a double).
else if(lineArray[0].equals("setVal") && lineArray.length == 2){
//Take lineArray[1], which is the name of a variable in
another class, specifically Feats.strength, Feats.agility, etc.
//Set that value in lineArray[1] to lineArray[2]
//Something like
set("Feats." + lineArray[1], lineArray[2]);
Feats.resetStat();
}
Does that make any sense? Thanks for the help in advance!