Solved Can someone please help me?

November 9, 2018 at 02:15:57
Specs: Windows 7
Hello! i wloud like to know the problem to my batch code!

i dont know why but when i enter 1 it supose to go to start! but it just exits!
there is some text art in there just ignore it -,-
here is my code:

@echo off
color 0a

:menu
title Game
cls
echo.
echo.
echo *************************************************************
echo W W EEEE L CCCCC OOO MM MM EEEEE
echo W W EEEEEE L C O O M M M EEEEEEE
echo W W W E L C O O M M M E
echo W W EEEEE LL CCCCC OOO M M M EEEEEE
echo ************************************************************
echo.
echo.
echo.
echo.
echo.
echo 1) Play
echo =-=-=-=-=
echo 2) quit
echo.
echo.
set /p c=C:\

if "%c%" == "1" goto start
if "%c%" == "2" goto Bye :(
goto menu


:Bye :(
cls
echo.
echo EEEEEEE I T
echo E T
echo EEEEEEE X X I TTT
echo E X I T
echo EEEEEEE X X I TT
echo.
echo Are you sure you want to exit?
echo -------------------------------------
echo /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
echo 1) Yes
echo -=-=-=-
echo 2) No
echo /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
echo -------------------------------------
echo.
set /p c=C:\

if "%c%" == "1" exit
if "%c%" == "2" goto menu

:start
set health=100
set monsterhealth=30
set playerdmg=7
set monsterdmg=3
goto home

:home
cls
echo.
echo Welcome to your house :D
echo.
echo _|=|__________
echo / \
echo / \
echo /__________________\
echo || || /--\ || ||
echo ||[]|| | .| ||[]||
echo ()||__||_|__|_||__||()
echo ( )|-|-|-|====|-|-|-|( )
echo ^^^^^^^^^^====^^^^^^^^^^^
echo.
echo.
echo 1) Fight
echo -=-=-=-=-=
echo 2) quit
echo.
set /p c=C:\
if "%c%" == "1" goto encounter1
if "%c%" == "2" goto menu
goto home


:encounter1
cls
echo You: %health%
echo Monster: %monsterhealth%
echo.
echo 1) attack
echo 2) surrender
echo.
set /p c=C:\

if "%c%" == "1" goto attack
if "%c%" == "1" goto home


See More: Can someone please help me?

Reply ↓  Report •

#1
November 9, 2018 at 06:20:50
give me a few min

i5-6600K[delid]@4.8GHz/4.4GHz@1.424v LLC=6 | 2x4GB Crucial-DDR4-2133CL15@14-14-14-28 1T 2800MHz@1.37v
MSI Armor RX 570 4GB@1400Mhz core@1.18v/1940MHz


Reply ↓  Report •

#2
November 9, 2018 at 06:33:46
✔ Best Answer
use this as example code, it also features loading and saving game data:

Text version: PokeBatch.bat
Link: http://pastebin.com/qhgTGvU5

2D version: PokeBatch2(D).bat
Link: http://pastebin.com/Rmf9t2Js

anyways, below code is working:


@echo off
color 0a
title Game
:menu
cls
echo.
echo.
echo *************************************************************
echo W W EEEE L CCCCC OOO MM MM EEEEE
echo W W EEEEEE L C O O M M M EEEEEEE
echo W W W E L C O O M M M E
echo W W EEEEE LL CCCCC OOO M M M EEEEEE
echo ************************************************************
echo.
echo.
echo.
echo.
echo.
echo 1) Play
echo =-=-=-=-=
echo 2) quit
echo.
echo.
choice /c 12 /n>nul
if %errorlevel%==1 goto start
if %errorlevel%==2 goto Bye
:Bye
cls
echo.
echo EEEEEEE I T
echo E T
echo EEEEEEE X X I TTT
echo E X I T
echo EEEEEEE X X I TT
echo.
echo Are you sure you want to exit?
echo -------------------------------------
echo /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
echo 1) Yes
echo -=-=-=-
echo 2) No
echo /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
echo -------------------------------------
echo.
choice /c 12 /n>nul
if %errorlevel%==1 exit/b
if %errorlevel%==2 goto menu
:start
set health=100
set monsterhealth=30
set playerdmg=7
set monsterdmg=3
goto home
:home
cls
echo.
echo Welcome to your house :D
echo.
echo.
echo __ii_______________
echo / ii /\\
echo / /__\ / \\
echo /_________________/ \\
echo i __ i /\ i
echo )\)\ i i__i i / .\ i
echo )\)\ /( i________________i_i__i_i
echo.
echo.
echo 1) Fight
echo -=-=-=-=-=
echo 2) quit
echo.
choice /c 12 /n>nul
if %errorlevel%==1 goto encounter1
if %errorlevel%==2 goto menu
:encounter1
cls
echo You: %health%
echo Monster: %monsterhealth%
echo.
echo 1) attack
echo 2) surrender
echo.
choice /c 12 /n>nul
if %errorlevel%==1 goto attack
if %errorlevel%==2 goto home
:attack
echo nothing here yet...
echo exiting in 3 sec
timeout 3 /NOBREAK
exit/b

i5-6600K[delid]@4.8GHz/4.4GHz@1.424v LLC=6 | 2x4GB Crucial-DDR4-2133CL15@14-14-14-28 1T 2800MHz@1.37v
MSI Armor RX 570 4GB@1400Mhz core@1.18v/1940MHz


Reply ↓  Report •

#3
November 9, 2018 at 08:08:43
Thank you soooo much!
i was really having struggle trying to find what was wrong...
i was about to quit.
Thank you so much!

message edited by Nasko3729


Reply ↓  Report •

Related Solutions

#4
November 9, 2018 at 08:19:49
Huh....
Weird...
I input the text art for the code you gave me and it breaks again...

Reply ↓  Report •

#5
November 9, 2018 at 08:27:53
the character:

|

is a wildcard, read as an instruction

escaping it as ^| does work

so your text art becomes:

echo _^|=^|__________
echo / \
echo / \
echo /__________________\
echo ^|^| ^|^| /--\ ^|^| ^|^|
echo ^|^|^[^]^|^| ^| .^| ^|^|^[^]^|^|
echo ^(^)^|^|__^|^|_^|__^|_^|^|__^|^|^(^)
echo ^( ^)^|-^|-^|-^|====^|-^|-^|-^|^( ^)
echo ^^^^^^^^^^====^^^^^^^^^^^

this site removes double spaces, so you'll have to add them again

i5-6600K[delid]@4.8GHz/4.4GHz@1.424v LLC=6 | 2x4GB Crucial-DDR4-2133CL15@14-14-14-28 1T 2800MHz@1.37v
MSI Armor RX 570 4GB@1400Mhz core@1.18v/1940MHz


Reply ↓  Report •

#6
November 9, 2018 at 09:20:02
Thank you! Im quiet intreset in game making... What site or Softoware do you reccomend? i spendhours and hours on this computer trying to find out witch one is the simplest and easy to use.

Reply ↓  Report •

#7
November 10, 2018 at 14:53:55
something like game maker studio 2.0 or Unity if you have the time.

Batch is uuhm very limited, for me making a game.

Re-making pokemon red for the game-boy color with music and a 2D walk-able map (wasd), took me about 2,5 years, if i can call it finished, since there are still about 100 trainers + triggers missing.

I did start with no knowledge of batch or programming in general tho :D

i5-6600K[delid]@4.8GHz/4.4GHz@1.424v LLC=6 | 2x4GB Crucial-DDR4-2133CL15@14-14-14-28 1T 2800MHz@1.37v
MSI Armor RX 570 4GB@1400Mhz core@1.18v/1940MHz


Reply ↓  Report •

#8
November 10, 2018 at 19:56:40
If you have any more problems like this or in fact anything to do with programming they should be posted here; https://www.computing.net/forum/pro...

Regards


Reply ↓  Report •

Ask Question