0

所以我正在为我的朋友制作一个简单的批处理游戏,当它到达这部分时,它告诉我 Echo 命令此时出乎意料并且关闭了我无法弄清楚它有什么问题请帮忙。

:WTS5
set /p chainboots=<"character\inventory\armor\chain\chainboots.txt"
set /p chaingloves=<"character\inventory\armor\chain\chaingloves.txt"
set /p chainhelm=<"character\inventory\armor\chain\chainhelm.txt"
set /p chainlegging=<"character\inventory\armor\chain\chainleggings.txt"
set /p chaintorso=<"character\inventory\armor\chain\chaintorso.txt"
set /p woodensword=<character\inventory\woodensword.txt
set /p Echainboots=<"character/equiped/armor/chain/chainboots.txt
set /p Echainlegging=<"character/equiped/armor/chain/chainleggings.txt
set /p Echaintorso=<"character/equiped/armor/chain/chaintorso.txt
set /p Echainhelm=<"character/equiped/armor/chain/chainhelm.txt
set /p Echaingloves=<"character/equiped/armor/chain/chaingloves.txt
set /p Ewoodensword=<"character/equiped/hands/woodensword.txt
set /p Ewoodensheild=<"character/equiped/hands/woodenshield.txt
cls
echo.
echo.
echo.
echo Current armor intems in inventory include:
echo %true% >"character/inventory/woodensheild.txt"
set /p woodensheild= <"character\inventory\woodensheild.txt"
if %chainboots%==%true% echo 575 Chain boots
if %chainleggins%==%true% echo 680 Chain leggings  
if %chaintorso%==%true%  echo 902 chain torso
if %chaingloved%==%true%   echo 588 Chain gloves
If %chainhelm%==%true% echo 795 Chain helm
echo.
echo.
echo Current weapons and shelds in inventory include:
If %woodensheild%==%true% echo 841 wooden shield
IF %woodensword%==%true%  echo 426 wooden sword

echo.
echo.
echo Current items in inventory include:
echo.
echo.
echo Type 1 to continue otherwise type item id to equip
echo.
set /p a="Enter Item ID:"
If %a%=575 (
 echo %false% > %chainboots%
 echo %true% > %Echainboots%
 goto WTS5 
) Else IF %a%==680 (
 echo %false% > %chainleggings%
 echo %true% > %Echainleggings%
 goto WTS5
) Else if %a%==902 (
 echo %false% > %chaintorso%
 echo %true% > %Echaintorso%
 goto WTS5
) Else if %a%==588 (
 echo %false% > %changloves%
 echo %true% > %Echaingloves%
 goto WTS5
) Else if %a%==795 (
 echo %false% > %chainhelm%
 echo %true% > %Ehainhelm%
 goto WTS5
) Else if %a%==841 (
 echo %false% > %woodenshield%
 echo %true% > %Ewoodenshield%
 goto WTS5
) Else if %a%==426 (
 echo %false% > %woodensword%
 echo %true% > %Ewoodensword%
 goto WTS5
) Else IF %a%==1 (
 goto WTS6
) Else (
 cls
 echo invalid ID
 pause
 goto WTS5
)
4

2 回答 2

0

将您的if比较放在双引号中:

If "%woodensheild%"=="%true%" echo 841 wooden shield
IF "%woodensword%"=="%true%"  echo 426 wooden sword
于 2013-08-20T17:34:09.423 回答
0

好的,所以在连续盯着代码超过 2 小时后,我发现了我的问题

 set /p chainlegging=<"character\inventory\armor\chain\chainleggings.txt"

if %chainleggins%==%true% echo 680 Chain leggings

拼写不一样

于 2013-08-21T02:26:22.123 回答