Save and Load .bat game

后端 未结 7 1637
予麋鹿
予麋鹿 2020-12-05 21:13

I\'m making a text game written in bat, and the game has been done, (or more, a good part of it, such as the commands, and at the stage where you can play it); however, I wa

7条回答
  •  Happy的楠姐
    2020-12-05 21:20

    Try something like this:

    @echo @ECHO OFF           > savegame.cmd
    @echo SET ITEMS=%ITEMS%   >> savegame.cmd
    @echo SET HEALTH=%HEALTH% >> savegame.cmd
    @echo SET MONEY=%MONEY%   >> savegame.cmd
    

    will "save" those three variables in savegame.cmd. Then you can call that file to reload the variables.

    (Doing it with a for /f is quite a bit trickier.)

提交回复
热议问题