Sorry if the title is confusing but I couldn't think of a better way to word it. I'm making a game with a friendship system and this is essentially what I'm trying to do:
playerChar = "Adam";
opinion_[playerChar]_Betty = 20;
so that later I can check
if opinion_Adam_Betty == 20;
playerChar
could be set to Adam
, Betty
, or Carmen
.
So if playerChar
was set to Adam
, then opinion_[playerChar]_Betty
and opinion_Adam_Betty
would actually refer to the same variable, but if playerChar
was set to Carmen
, opinion_[playerChar]_Betty
would be referring to the variable opinion_Carmen_Betty
instead, and no longer be the same variable as opinion_Adam_Betty
.
In essence, I want opinion_[playerChar]_Betty
to be able to refer to different variables depending on what the variable playerChar
is set to. Not sure if this is possible or not (or if I'm just overcomplicating things) but it would make some things super convenient for me if it were.