I'm in the process of creating a mini-game using batch and one of the useful tool ideas was to have an interactive notepad so that users could store information throughout the game and refer back to it later. So far I have created the option to goto a notepad within an In-game pause menu but wasn't sure if it was possible to save results without outputting to new file on the desktop
:PauseMenu
cls
echo.
echo %Alias%
echo.
echo Notepad
echo Stats
echo Untitled2
echo Untitled3
echo Untitled4
echo Untitled5
echo Untitled6
set/p PauseMenu="N, S"
IF ["%PauseMenu%"]==["N"] goto Notepad
IF ["%PauseMenu%"]==["S"] goto Stats
IF ["%PauseMenu%"]==["N"] goto
IF ["%PauseMenu%"]==["N"] goto
IF ["%PauseMenu%"]==["N"] goto
IF ["%PauseMenu%"]==["N"] goto
IF ["%PauseMenu%"]==["N"] goto
Any help would be appreciated, thanks.
PS is it possible to go back to the previous page from a menu?
Simplicity itself.
First, some renaming may be in order.
notepadis a supplied utility andpausemenuis being used both as a variable and as a label. This is not invalid, but can be a little confusing.Further, if you are choosing between a set of keys, I'd suggest you investigate
choice.choicehas a number of advantages, like it only accepts one character, noenteris required and it's not necessary to analyse the entry.So: revising your code:
Here, a menu with a number of unimplemented options is presented and the
choicecommand (seechoice /?from the prompt for more options) waits for a choice to be made.errorlevelis set according to the choice made - but sinceif errorlevel nmeansif errorlevel is n OR GREATER THAN nyou need to processerrorlevelin reverse order.Then each selection is processed.
nwill start anotepadinstance and load thealias.txtfile from the game directory, then present the menu again as it returns topausemenu.swill show the stats (idk what you need for that) and then return top_pausemenuwhich will pause and then proceed to show the menu when the user signals to do so.