I searched this site for my question, but I didn't find a solution to my problem.
The system gives a random number for the player and for the computer, from 2 to 12.
This has 3 parts, if X bigger than Y, if X lesser than Y, and when X is same as Y.
When I start the .bat
, it works great, I choose Play Game
, I enter the Bet (20 for example), but when I start this process, the window closes, and I can't read what it wrote. I can see some flashing text, I have seen 'Your' and 'syntax', but it disappears very fast.
I'm really sure it worked, because when I delete the 3 if if if
things, it shows my money, bet, stats and everything, and I can even decrease or increase it with 'cheats' I wrote.
So, here it is:
set /p setbet=Please type a number to select bet:
if "%setbet%"=="1" set bet=20
if "%setbet%"=="2" set bet=50
if "%setbet%"=="3" set bet=100
if "%setbet%"=="4" set bet=150
if "%setbet%"=="5" set bet=200
if "%setbet%"=="6" set bet=250
if "%setbet%"=="7" set bet=300
echo.
echo Your bet is %bet%.
echo.
pause
cls
set /a money-=bet
set /a playernum=%random% %%12 +2
set /a enemynum=%random% %%12 +2
echo.
echo You roll: %playernum%
echo Enemy rolls: %enemynum%
echo.
if %playernum% LSS %enemynum%
(
echo Enemy wins. Please try again.
echo Your current money is %money%.
echo You lost %bet% money.
echo.
pause
goto INTRO
)
if %enemynum% LSS %playernum%
(
set /a money+=bet*2
echo You win.
echo Your current money is %money%.
echo You won %bet% money.
echo.
pause
goto INTRO
)
if %enemynum% EQU %playernum%
(
set /a money+=bet
echo It's a tie.
echo You won the bet (%bet%), but your money didn't changed.
echo Your money is now %money%.
echo.
pause
goto INTRO
Thank you!