1.

Solve : Batch script syntax help??

Answer»

I am currently trying to make a game in windows batch script, just a LITTLE TEXT based thing for fun. At one part of the game, the player has to be above a certain level to enter an area, and if they are below they are given a message and redirected. Problem is, it keeps telling me there is a syntax error even though I cant TELL what it is. Here, I'll let you look at the code and see if I can get any suggestions on how to improve this.
Code: [Select]:explore-east
cls
echo You turn to your right and see a large stone
echo structure that has been overgrown with thick
echo moss and grass and vines. It appears to be
echo the entrance to some kind of underground
echo catacombs.
pause
if '%lvl%' == '4'(
cls
echo A strong urge to explore inside the stone
echo structure fills you, but you know that you
echo arent strong enough to protect yourself from
echo whatever may be inside...
pause
goto explore
)
if '%lvl%' == '5' (
cls
echo You feel drawn to explore the inside of the
echo catacombs...
pause
cls
echo You MOVE some of the vines out of the way
echo and see a large door behind them. It has
echo symbols inscribed all over it. You push on it
echo but it doesnt budge.
pause
cls
echo You decide to head out and get some more
echo experience before you try to head into the
echo area again.
pause
goto explore
)
if '%lvl%' == '5' | '6' | '7' | '8' | '9' | '10' (
echo You enter the catacombs with no problem...
pause
goto Cata1
)
So there it is... If you can help, please give suggestions. Thanks!'|' is not a logical operator in batch script.
Code: [Select]set "yes="
for /L %%a in (5,1,10) do if %lvl% EQU %%a set yes=1
if not defined yes echo Go away or I SHALL taunt you for a second time! & pause & goto :start
echo Welcome Green Wizard!



Discussion

No Comment Found