haasocialmedia.blogg.se

How to make a text based game in batch script
How to make a text based game in batch script











how to make a text based game in batch script
  1. #HOW TO MAKE A TEXT BASED GAME IN BATCH SCRIPT HOW TO#
  2. #HOW TO MAKE A TEXT BASED GAME IN BATCH SCRIPT WINDOWS#

But better is to use = for comparing two strings.įourth, don't use set /p if the user should choose one of several options.

#HOW TO MAKE A TEXT BASED GAME IN BATCH SCRIPT WINDOWS#

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. The comparison operator EQU is for integer comparisons, not for string comparisons. Third, read my answer on Symbol equivalent to NEQ, LSS, GTR, etc. FAILS to give text or blank line - Instead use ECHO/ for the explanation. and use instead echo/ to output an empty line. You can get help for every Windows command by running in a command prompt window the command with /? as parameter, for example if /?, set /?. An A-Z Index of the Windows CMD command line (SS64).Any pointer in general?įirst, I suggest to bookmark in your browser: When I get LGame to work, how exactly would you call the save file?Īnd, if possible, some pointers on an inventory system and a pause menu that you can bring up at any time and then go back to the screen you were in before.How could I make it so when you save the game, you go back to the.For the moment it's just supposed to print the message, but if I run it it just crashes. So the thing is that I can't get the LGame method (I don't know how you call that in Batch, complete beginner at programming in general so bear with me). If "%action2%" neq "Save Game" goto SaveTutorialĪs you may notice, this isn't really too far along.

how to make a text based game in batch script

If "%action2%" equ "Save Game" goto SaveGame If "%action1%" neq "take hoe" echo TUTORIAL *Type take hoe followed by Enter.*Įcho TUTORIAL *You can save progress whenever you can type by typing Save Game.* Her best hoe laid on the floor.Įcho TUTORIAL *Type take followed by an object and press enter in orderĮcho to pick it up and add it to your inventory.* The cold early-spring air snipping at herĮcho bare arms. She got dressed and left for the toolĮcho shed outside her house. His best hoe laid on the floor.Įcho drinking the previous night. The cold early-spring air snipping at hisĮcho bare arms. He got dressed and left for the toolĮcho shed outside his house.

how to make a text based game in batch script

The so-called king hasĮcho placed himself on the throne with the help of twisted creatures.Įcho TUTORIAL *Press Space Bar to continue narrative.*Įcho There have been talks about a coup or silent assasinations butĮcho nothing has been proven to be but a rumor.Įcho %name% got out of bed that morning with a headache born from heavyĮcho drinking the previous night. There was a time where one couldĮcho walk around town without being disturbed. If %sex% equ woman goto StartAdventureWomanĮcho Kovalor wasn't always like this. %playerLVL%Įcho For now you have no weapons nor armor. %playerDEF%Įcho Level dictates the experience you have as an adventurer. Goto OFF > SET name=%name% > SET sex=%sex% > SET playerHP=%playerHP% > SET playerATK=%playerATK% > SET playerDEF=%playerDEF% > SET playerLVL=%playerLVL% > save%name%.batĮcho Health, when it depletes, you die.

how to make a text based game in batch script

offĮcho Press any key to return to Main Menu. So I'm having a few problems and have a few questions.

  • See our choice command page for further information and options.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.
  • If any of these are pressed, it goes to the label with goto and echoes the number pressed. In the above batch file, choice has the 1, 2, or 3 option.

    #HOW TO MAKE A TEXT BASED GAME IN BATCH SCRIPT HOW TO#

  • See our set command page for further information and options.īelow is how to use the choice command to give three options and perform a specific step.
  • If 1, 2, or 3 is entered, goto goes to the corresponding label and performs the echo and goes to the end of the batch file. In the above batch file, the %choice% variable is assigned when the user enters data and presses enter with the set /p choice line. Set /p choice=Type the number to print text. Below is how you can use the set command to give batch file users the ability to press 1, 2, or 3 and perform the steps for the option pressed.













    How to make a text based game in batch script