基本上,我做了一個腳本,就像那些「拿起鑰匙」或「打怪獸」類型的遊戲......批處理腳本不工作(使用記事本++此)
這裏的問題。我做功能
:beginning2
cls
echo You're in a room with a broken glass, a chest, a mirror, a counter with a small object on it, and a door.
echo What do you want to do?
set /p beginning2=Action:
if "%beginning2%"=="look at counter" goto counter
它應該去「計數器」這是腳本的這一部分。
:counter
cls
echo There is a small object on this counter.
echo It appears to be a key.
set /p counter=Action:
if "%counter%"=="pick up key" goto beginning3
這是整個腳本。
@echo off
color 0a
:beginning1
cls
title Adventure
echo You're in a room with a broken glass, a chest, and a mirror.
echo The room has no light.
echo What do you want to do?
set /p input=Action:
if "%input%"=="open chest" goto chest
if "%input%"=="look at mirror" goto mirror
:beginning2
cls
echo You're in a room with a broken glass, a chest, a mirror, a counter with a small object on it, and a ab door.
echo What do you want to do?
set /p beginning2=Action:
if "%beginning2%"=="look at counter" goto counter
:beginning3
cls
echo You're in a room with a broken glass, a chest, a mirror, a counter with nothing on it, and a door.
echo You also hold a key.
echo What do you want to do?
set /p beginning3=Action:
if "%beginning3%"=="open chest" goto chest2
if "%beginning3%"=="look at counter" goto counter
:beginning4
cls
echo You're in a room with a broken glass, an opened chest, a mirror, a counter with nothing on it, and a door.
echo You also hold a key.
echo What do you want to do?
set /p beginning4=Action:
if "%beginning%"=="open door" goto door
:chest
cls
echo The chest is locked. What do you want to do now?
set /p chest=Action:
if "%chest%"=="back" goto beginning1
if "%chest%"=="look at mirror" goto mirror
:chest2
cls
echo You hold a key, and a chest appears infront of you.
echo What do you want to do now?
set /p chest2=Action:
if "%chest2%"=="open chest" goto chest3
:chest3
cls
echo The chest clicks open!
echo In it appears to be another key, but slightly bigger.
echo What do you want to do now?
set /p chest3=Action:
if "%chest3%"=="back" goto beginning4
:mirror
cls
echo You look in the mirror.
echo You see nothing because the room has no light.
echo What do you want to do now?
set /p mirror=Action:
if "%mirror%"=="turn on lights" goto lights
if "%mirror%"=="back" goto beginning1
:lights
cls
echo You turned on the lights!
echo You've revealed a counter with a small object on it, and now there is light in the mirror.
set /p lights=Action:
if "%lights%"=="look at mirror" goto mirror2
:mirror2
cls
echo You look at a mirror, you see yourself with a pen mark on your arm that says "0212"
set /p mirror2=Action:
if "%mirror2%"=="back" goto beginning2
:counter
cls
echo There is a small object on this counter.
echo It appears to be a key.
set /p counter=Action:
if "%counter%"=="pick up key" goto beginning3
:door
cls
echo You go to the door with a key, and open it. It clicks open simply.
請幫助我,因爲它是如此令人沮喪。這很奇怪,因爲它只是說「goto counter」,但它不適用於我。
關閉-topic:你是如何在批處理文件中製作遊戲的?你爲什麼不使用正常的編程語言?即使使用cmd輸入和輸出的Perl,開發遊戲也會更容易。 – Regent 2014-09-04 05:25:09
如果你製作一個基於控制檯的遊戲,我會推薦python。快速,簡單和易於學習。 – Monacraft 2014-09-04 06:30:57