我正在批量挑选自己的冒险游戏,并且我希望拥有它的统计数据来跟踪您在游戏中的表现。我想显示统计信息,但每次我有一个cls
命令时,我必须这样做,并且由于我经常使用该命令,因此我创建了一个名为:Stats
的块,以便每次需要时都可以调用它。它工作正常,但统计显示后的叙述似乎不再有效。我想保留:colorEcho
区块,所以玩家可以区分对话,叙述和命令来输入选项。有想法该怎么解决这个吗?通话功能不起作用?
:Start
::Game goes here.
cls
Echo Please enter your player name.
set /p PlayerName="Player name: "
cls
call :Stats
call :colorEcho 7 "You lay on the cold, hard ground, sleeping away. It's been 1 month since the Virus spread..."
Echo.
call :colorEcho 7 "The sun rises over the horizon, warming up your dirt-caked body."
Echo .
pause
exit
:Stats
call :colorEcho A "Current Health = "
call :colorEcho C " %Health%"
Echo.
call :colorEcho A "Hunger = "
call :colorEcho C " %Food%"
Echo.
call :colorEcho A "Thirst = "
call :colorEcho C " %Water%"
Echo.
call :colorEcho A "Infection = "
call :colorEcho C " %Infection%"
Echo.
call :colorEcho A "Stamina = "
call :colorEcho C " %Stamina%"
Echo.
Echo.
pause
:colorEcho
echo off
<nul set /p ".=%DEL%" > "%~2"
findstr /v /a:%1 /R "^$" "%~2" nul
del "%~2" > nul 2>&1i
附注:我已经定义了所有的变量。我确定了。
请告诉我应该发生:
实际发生的:
你忘了'退出/ b'或者'goto:eof'结尾ubroutine,所以':Start'属于':colorEcho'。 – dbenham
那究竟做了什么? –