Thank you for being a valued part of the CNET community. As of December 1, 2020, the forums are in read-only format. In early 2021, CNET Forums will no longer be available. We are grateful for the participation and advice you have provided to one another over the years.

Thanks,

CNET Support

General discussion

Help Writing Batch File!!!

Mar 3, 2007 10:27PM PST

Im making a small text game called "naruto ultimate chronicles" out of batch (yes,its gay. But Im only 13 so its cool to me Silly).Anyways,look at my script.
-------------------------------------
@echo off
echo Welcome To 2-Player Naruto Ultimate Chronicles!

::Starting Life
:A
set _cnumber1=1000
set _cnumber2=1000
set _lnumber1=1000
set _lnumber2=1000
goto :B

::Kawarimi
:kU
set /a _cnumber2=_cnumber2 - 10
if /i %_move2%==rasengan goto P1r
goto :U

Silly2k
set /a _cnumber1=_cnumber1 - 10
set /p_move2="%_name2%'s Turn (type "list" for list of jutsu):"
if /i %_move2%==rasengan goto P2r
goto :U

::Kawarimi / Rasengan
P2r
set/a _lnumber1=_lnumber1 - 50
goto :U
P2r
set/a _lnumber1=_lnumber1 - 50
goto :U


::Names
:B
set /p_name1="What's Your Name P1?"
set /p_name2="What's Your Name P2?
goto :C


::Results
:U
echo %_name1% Used %_move1%!!!
echo %_name2% Used %_move2%!!!
if /i %_cnumber1% leq 0 goto end1
if /i %_cnumber2% leq 0 goto end2
if /i %_lnumber1% leq 0 goto end3
if /i %_lnumber2% leq 0 goto end4

::Stats
:C
echo %_name1%'s Life: %_lnumber1%
echo %_name1%'s Chakra: %_cnumber1%
echo %_name2%'s Life: %_lnumber2%
echo %_name2%'s Chakra: %_cnumber2%


::Turns
Silly1m
set /p_move1="%_name1%'s Turn (type "list" for list of jutsu):"
if /i %_move1%==list goto list1
if /i %_move1%==kawarimi goto P2k
Silly2m
set /p_move2="%_name2%'s Turn (type "list" for list of jutsu):"
if /i %_move2%==list goto list2
if /i %_move2%==kawarimi goto kU
if /i %_cnumber1% leq 0 goto end1
if /i %_cnumber2% leq 0 goto end2
if /i %_lnumber1% leq 0 goto end3
if /i %_lnumber2% leq 0 goto end4


::Execute Move
Silly1
goto %_move1%1

Silly2
goto %_move2%2


::Jutsus (Make 2 For Each Jutsu [Append Each With 1/2])

::Jutsu List

:list1
echo List Of Jutsus
echo - Chidori ( 100 chakra, 100 damage )
echo - Rasengan ( 50 chakra, 100 damage, 50 damage to self )
echo - Kawarimi ( 10 chakra, block opponents attack )
goto P1m
:list2
echo List Of Jutsus
echo - Chidori ( 100 chakra, 100 damage )
echo - Rasengan ( 50 chakra, 100 damage, 50 damage to self )
echo - Kawarimi ( 10 chakra, block opponents attack )
goto P2m


:chidori1
set /a _cnumber1=_cnumber1 - 100
set /a _lnumber2=_lnumber2 - 100
goto Silly2
:chidori2
set /a _cnumber2=_cnumber2 - 100
set /a _lnumber1=_lnumber1 - 100
goto :U

:rasengan1
set /a _cnumber1=_cnumber1 - 50
set /a _lnumber2=_lnumber2 - 100
set /a _lnumber1=_lnumber1- 50
goto Silly2
:rasengan2
set /a _cnumber2=_cnumber2 - 50
set /a _lnumber1=_lnumber1 - 100
set /a _lnumber2=_lnumber2 - 50
goto :U

:kawarimi2
set /a _cnumber2=_cnumber2 - 10
set /a _move1=_b1
goto :U


::Ending
:end1
echo NO CHAKRA REMAINING FOR %_name1% , CANNOT USE JUTSU. %_name2% WINS!!!
goto :EOF

:end2
echo NO CHAKRA REMAINING FOR %_name2% , CANNOT USE JUTSU. %_name1% WINS!!!
goto :EOF

:end3
echo NO LIFE REMAINING FOR %_name1% , %_name2% WINS!
pause
goto :EOF

:end4
echo NO LIFE REMAINING FOR %_name2% , %_name1% WINS!
pause
goto :EOF


:EOF
------------------------------------------------------
The problem is, I need a script that checks what you type. Because right now if you type the wrong attack the program closes. This can cause big problems...can anyone help with a script that checks if you type correctly,and if not,tells you to retype your attack. Im busting my *** over this. As you can see I am fairly new at .bat files,although I do pretty well in HTML,javascript and CSS.Thanks in advance. Wink

Discussion is locked