Hello, I'm just starting out in the world of programming and batch scripting and the like. I know, it's 2018, where have I been??
So, I'm attempting to write a basic puzzle game, just to get it all down pat before I expand and try to make a "full size" game. There are a few concepts that I thought would be doable with my current knowledge, but alas, are not. The first is writing multiple words for an answer, example
set /p answer= You see a glowstick, what do you do?
if %answer%==Pick Up Glowstick goto ObservationDeck_NoStick
however typing in Pick Up Glowstick, causes the game to crash. Any clues as to what I am doing wrong?
The other main issue I am having is creating an Inventory to store the items and hopefully remove them from the scene. It's a two fold question I guess. How do I set up the inventory and is there a way to remove the item from the "scene" or do I stick to the current method of making a new scene that simply doesn't include it. Example
echo The observation desk is empty.
echo You see a glowstick on a bench
set /p answer= What would you like to do?
if %answer%==Pick up glowstick *inventory part here(?)*
goto ObservationDesk_NoGlowstick
If this has already been covered somewhere, my search skills are lacking and I apologize. Also, thank you in advance!
Batch Text Game?
Moderator: DosItHelp
Re: Batch Text Game?
The comparison has to know where to stop so it knows what command to run. Spaces are a delimiter of a command so it thinks the next word after the space is the command it has to run.
Let's take this for example. Let say you want to check if there answer was equal to GOTO GOTO.
How would it know which goto is the actual GOTO command and not the string it is comparing.
So when comparing strings you always quote as a best practice.
Let's take this for example. Let say you want to check if there answer was equal to GOTO GOTO.
Code: Select all
if %answer%==goto goto goto label
So when comparing strings you always quote as a best practice.
Code: Select all
if "%answer%"=="goto goto" goto label