Incredibly rookie coder here. I'm making a game and currently trying to make it more optimized because while I've heard people tell me that I should just code and wait to optimize later on, this code I feel like is too brute force-y and there is a much smarter solution to do what I'm trying to do. And by that I mean...
Basically, I have this code right here:

Figured this was a terrible way to code, so I decided to try out a for loop! Like so:

But then there was one big problem! The file path, "$CommandBox/CommandList/Command1".
Command1 worked when Character1CommandActions[0] was being matched, but I need it to be Command2 for Character1CommandActions[1], Command3 for Character1CommandActions[2], and so on and so forth.
And that's where I get stuck. I tried to perhaps use variables to construct it, like this.

But that gave me an error(Invalid operands 'Object' and 'int' in operator '+'.), so that couldn't have been it. I learned about NodePath and tried putting it in. Also an error. I tried converting the things inside the NodePath into a string. Still an error.
Then there was also that file paths inside a variable did not like ".texture.region"? I ended up getting this error too(Invalid get index 'texture' (on base: 'null instance').).
Trying not to pull my hair out, this is so stressful and I am stuck on what to do. Do you guys know how to implement file paths into a variable? And if you don't, is there maybe a better way to go about what I want to achieve rather than do a for loop? I am very new and almost all of the concepts Godot has to offer will be alien to me, I'd like some assistance if possible. Thank you!