i am trying to make a game, with stat leveling that i based on the fallout games.
:Stats_List
cls
echo now you will see your stats
echo they are random, so if you don't like them, close out and restart.
pause
set starter-str=0
set starter-per=0
set starter-end=0
set starter-chr=0
set starter-int=0
set starter-agl=0
set starter-lck=0
echo str: %starter-str%
echo per: %starter-per%
echo end: %starter-end%
echo chr: %starter-chr%
echo int: %starter-int%
echo agl: %starter-agl%
echo lck: %starter-lck%
echo you are base lvl
echo you have 15 points avalible
echo .................................................
echo pick a stat to give a point to
echo 1: str
echo 2: per
echo 3: end
echo 4: chr
echo 5: int
echo 6: agl
echo 7: lck
set /p statpick1=
if %statpick1%==1 set /a starter-str=%starter-str%+1
if %statpick1%==2 set /a starter-per=%starter-per%+1
if %statpick1%==3 set /a starter-end=%starter-end%+1
if %statpick1%==4 set /a starter-chr=%starter-chr%+1
if %statpick1%==5 set /a starter-int=%starter-int%+1
if %statpick1%==6 set /a starter-agl=%starter-agl%+1
if %statpick1%==7 set /a starter-lck=%starter-lck%+1
whenever i put in this command, or the others like it
if %statpick1%==5 set /a starter-int=%starter-int%+1
and i put
echo %starter-int%
it tells me there is a missing operator and gives me the original value of zero. i know a way around it, but it is a lot of unnecessary work. this is also one of my first cmd projects. I'm still a noob at this.
is this possible?
Moderator: DosItHelp
Re: is this possible?
Mmm... Your question title is very undescriptive... "is this possible?" (What is possible? In the description you talk about a syntax error)...
The problem is that all your variable names, like starter-str includes a dash that is also used for subtract operation in set /A command. You can not do that. As a matter of fact, you can include a lot of special characters in variable names, but you can not include any character that is also an arithmetic operator if you want to use such a variable in SET /A command.
PS - Before you continue using several variables with the same name in the first part I encourage you to read about arrays in Batch.
Antonio
The problem is that all your variable names, like starter-str includes a dash that is also used for subtract operation in set /A command. You can not do that. As a matter of fact, you can include a lot of special characters in variable names, but you can not include any character that is also an arithmetic operator if you want to use such a variable in SET /A command.
PS - Before you continue using several variables with the same name in the first part I encourage you to read about arrays in Batch.
Antonio