我正在批量製作遊戲。我知道這批並不是很強大,但這是我的第一場比賽。無論如何,我正在做一個if語句,如果你經過1號門,你將會生活,但如果你經過2號門,你會死。不幸的是,當我經過任何一個門時程序重新啓動。在這裏,我會告訴你我的代碼:批處理(如果語句)的問題
`@echo off
color 02
::stats
set Badasspts=0
:Beginning
echo Hello what is your name?
set /p name=
echo Hello %name%!
echo You have two doors to go through. Which one? Possible answers: 1 or 2
set /p answer1=
if answer1==1 goto youLive
if answer1==2 goto youDie
:youDie
echo Behind this door is an alligator pit you accidentally fall in and die!
goto Beginning
:youLive
echo Well... well... well... you live this time but now ummm... A wild monster appears. What do you do? Possible answers: hug, attack
set /p hugAttck=
if hugAttack==hug goto hug
if hugAttack==attack goto attack1
:hug
echo You hug that cute furry monster soooo hard that he dies. Plus 1 BADASS points!!!!
pause`
說明:我在Notepad ++中編程。它還沒有完成,所以是啊。
你如何運行這個腳本?將它保存到* .bat文件並從命令行運行它? – zehelvion