Cant get set /a to work (REVISION)

March 29, 2011 at 17:25:29
Specs: Windows 7
Okay, I remade it so it's much more readable and to the point.
I made it so it sets the title of the window to your hp every time you are attacked.
But still, it's not working. Is there an alternative method to accomplishing this?

@echo off
set health=100
set monsterhp=50
title YOUR HP: %health%
title YOUR HP: %health%
echo MONSTER HP:%monsterhp%/50
echo You are defenseless!
echo 1. Get attacked by monster
set /p monster=
if %monster%==1 goto attacked ELSE (
goto monster
set /a %health% - 5
if %health% leq 0 goto death
goto monster
title YOUR HP: 0
echo You died.
echo The end!

See More: Cant get set /a to work (REVISION)

Report •

March 29, 2011 at 18:35:20
It has been a very long time since I did any of this, but if I'm not mistaken shouldn't it read something like:

set /a %health%=%health% - 5

Not at all sure about this.


Report •

March 29, 2011 at 18:55:24
It should actually be:

set /a health=%health% - 5


set /a health=health - 5


set /a health-= 5

Report •

Related Solutions

Ask Question