For the shop I'm trying to use inequalities to determine if an item can be purchased, however the window quits without explanation whenever I run it. Fairly certain it's because of the way I'm using variables but haven't found anything telling me the proper way yet.
Before you roast me too hard, keep in mind:
I know I'm not doing it the most efficient way possible
This is one chunk I'm testing from a larger game I'm creating
There are probably issues in other areas besides just variables that I don't know about
Code: Select all
@echo off
set /a money=2000
set /a medikit=0
:shop
cls
echo Welcome to the shop
echo Current Balance %money%
echo.
echo [Medikit] 100
echo.
echo [Inventory]
set /p input=What would you like to buy?:
if %input%==Medikit (
set/a cost=100
goto buymed)
if %input%==Inventory (
goto inventory)
:buymed
if %money%GEQ%cost% (
set /a medikit+=1
set /a money-=cost
echo Thanks for your Purchase
pause
goto shop) else (
echo Error insuffienct funds
pause
goto shop)
:inventory
echo Inventory
echo.
echo Medikits x%medkit%
echo.
pause
goto shop