Web Hosting, Design, & Coding forum

General discussion

Help Writing Batch File!!!

by gameking66 / March 3, 2007 10:27 PM 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 :P).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

:P2k
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
:P1m
set /p_move1="%_name1%'s Turn (type "list" for list of jutsu):"
if /i %_move1%==list goto list1
if /i %_move1%==kawarimi goto P2k
:P2m
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
:P1
goto %_move1%1

:P2
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 :P2
: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 :P2
: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
You are posting a reply to: Help Writing Batch File!!!
The posting of advertisements, profanity, or personal attacks is prohibited. Please refer to our CNET Forums policies for details. All submitted content is subject to our Terms of Use.
Track this discussion and email me when there are updates

If you're asking for technical help, please be sure to include all your system info, including operating system, model number, and any other specifics related to the problem. Also please exercise your best judgment when posting in the forums--revealing personal information such as your e-mail address, telephone number, and address is not recommended.

You are reporting the following post: Help Writing Batch File!!!
This post has been flagged and will be reviewed by our staff. Thank you for helping us maintain CNET's great community.
Sorry, there was a problem flagging this post. Please try again now or at a later time.
If you believe this post is offensive or violates the CNET Forums' Usage policies, you can report it below (this will not automatically remove the post). Once reported, our moderators will be notified and the post will be reviewed.
Popular Forums
icon
Computer Newbies 10,686 discussions
icon
Computer Help 54,365 discussions
icon
Laptops 21,181 discussions
icon
Networking & Wireless 16,313 discussions
icon
Phones 17,137 discussions
icon
Security 31,287 discussions
icon
TVs & Home Theaters 22,101 discussions
icon
Windows 7 8,164 discussions
icon
Windows 10 2,657 discussions

CNET FORUMS TOP DISCUSSION

Help, my PC with Windows 10 won't shut down properly

Since upgrading to Windows 10 my computer won't shut down properly. I use the menu button shutdown and the screen goes blank, but the system does not fully shut down. The only way to get it to shut down is to hold the physical power button down till it shuts down. Any suggestions?