batch file - if %variable% ==, not working -
so making rpg, pokemon style fighting game (with movie characters) test skills, need more work. batch (.bat) file, using notepad++. "katniss
" part work, while other 3 don't work. %char%
(character) set , katniss works can't problem there. problem "if
" statement think. here fragment of code, have whole thing it's around 400 lines , i've narrowed down section using pause
s.
`:character2 cls rem --------------------------------------------------characters aren't working here if %char% == katniss set hp=100 set mattack1=knife set rattack1=arrow set rattack2=fire arrow set rattack3=explosive arrow set block1=bow block set armr=2 set energy=140 set m1enc=50 set m1hpd=25 set m2enc=25 set r1hpd=20 set r1enc=65 set r2hpd=50 set r2enc=110 set r3hpd=75 set r3enc=140 set bk1md=5 set bk1ec=50 set defense=2 goto corc if %char% == gandalf set hp=120 set mattack1=staff set mattack2=sword set mgttack1=fireball set mgttack2=blast set mgttac2=staff set block2=magic shield set block3=sword set armr=0 set energy=100 set m1hpd=15 set m1enc=40 set m2hpd=40 set m2enc=90 set mg1hd=45 set mg1ec=100 set mg2hd=10 set mg2ec=25 set mg3hd=5 set mg3ec=25 set bk1md=5 set bk1ec=80 set bk2md=25 set bk2ec=100 set bk3md=3 set bk1ec=45 set defense=0 goto corc`
i tried yahoo answers person didn't read full question , said needed set %char%
.
----answer turned out (
)
thing, missed few , prevented variable being set ""
had nothing it.
use parentheses:
if %char% == katniss ( set hp=100 set x=1 set y=2 )
Comments
Post a Comment