Say I have set a few variables...
set x=1
set y=1
set x1y2=J
set x%x%y%y%=Y
In the game I am creating using cmd, the name of the variable x%x%y%y%
changes very often, because x
and y
are always changing and x%x%y%y%
is dependant x
and y
.
Now I want to use an if statement to check the value of x2y2
.
if %x%x%y%y%%=J echo Yay
The two percent sign at the beginning and end are to call the variable, but the percent signs inside are also calling variables.
Use this to help visualise it (I know, it's confusing)
This is all one big variable
______________|______________
| |
% x % x % y % y % %
| |___| | |___|
A letter | A letter |
These two are smaller variabels set previously
But obviously the syntax is correct, because there is no variable called '1x1y' and there is an extra %
. And remember, I can't just type the variable name because the some variables are always changing. What do I do..?
If you're confused, please ask questions, and if it is lacking anything feel free to post that in the comments too.
Thanks in advance.