2020. 2. 22. 05:17ㆍ카테고리 없음
So I decided to learn Batch and I'm trying to program a small RPG/adventure game that is narrative driven for the RPG snuffs at the office. So I'm having a few problems and have a few questions. First, I suggest to bookmark in your browser:. (SS64)You can get help for every Windows command by running in a command prompt window the command with /?
As parameter, for example if /?, set /?Second, I suggest to avoid echo. And use instead echo/ to output an empty line.
Text Based Rpg Game
Take a look on DosTips forum topic for the explanation.Third, read my answer on. The comparison operator EQU is for integer comparisons, not for string comparisons. It works also for string comparisons as fall-back if Windows command interpreter recognizes that one of the two arguments to compare is not an integer. But better is to use for comparing two strings.Fourth, don't use set /p if the user should choose one of several options. There are multiple facts which must be taken into account on prompting user for entering a string and assigning it to an environment variable:.On usage of set /P 'MyVar=Your choice: ' the environment variable MyVar is not modified if the user presses intentionally or by mistake just RETURN or ENTER. This means if the environment variable MyVar is not defined already before the user prompt, it is still not defined after user prompt finished with just hitting key RETURN.
Batch File Games
And if MyVar is defined already before user prompt, it keeps its value unmodified in case of user presses just RETURN or ENTER.The user has the freedom to type any string on being prompted with set /P. The batch file writer has no control on what the user really enters.