1. This is an off-topic section of the forum.
    If you have an issue related to BeamNG, please post in Troubleshooting section instead.

help with a file I made

Discussion in 'Computer Hardware' started by simonfrat123, Mar 31, 2016.

  1. simonfrat123

    simonfrat123
    Expand Collapse

    Joined:
    Jun 16, 2015
    Messages:
    331
    I made some of my text adventure game in Notepad ++ like I was instructed, saved as a .bat file opened with cmd like instructed, and it says
    "would you like to start the game"
    1. start the game
    2. leave
    enter:
    I type 1 cmd closes

    anyone got an idea here is my code.
     

    Attached Files:

    • Dwm 2016-03-30 19-08-52-64.jpg
    • Dwm 2016-03-30 19-08-58-65.jpg
  2. Nils Rossi

    Nils Rossi
    Expand Collapse

    Joined:
    Mar 31, 2016
    Messages:
    0

    Hi simonfrat123,
    with properly named Variabels this runs perfectly for me.


    in :startup you defined an Variabel "input0"
    and tested afterwards for "input0" and "input" (without "0")
    so, i changed them to "start"


    in :naming you defined the variabel "input1" to be the Entered name, but in :home you tried to display the variabel "name", i changed both to be "name"
    (is it Variabel or Variable in english?)

    I've added the game.bat in the *.zip file in the attachment and here for copy n' paste:

    @echo OFF
    TITLE Game test


    :startup
    cls
    echo Would you like to start the game?
    echo.
    echo 1. Start the game.
    echo 2. Leave.
    echo.

    set /p start=Enter:

    if %start% equ 1 goto begin
    if %start% equ 2 exit
    goto startup

    :begin
    cls
    set hp=100
    set gold=100
    set damage=0
    set armor=0

    goto naming

    :naming
    echo Hello ..
    echo.
    echo What is your name?
    echo.
    set /p name=Enter:

    goto welcome

    :welcome
    echo Welcome to the game.
    echo Here are your stats...
    echo health - %hp%
    echo money - %gold%
    echo armor - %armor%
    echo.
    echo Press any key to continue.
    pause>nul
    goto home

    :home
    echo Hello, %name%
    echo --------------
    echo. stats
    echo health - %hp%
    echo money - %gold%
    echo armor - %armor%

    echo Press any key to continue.
    echo --Here the programm ends, i dont know if you want to add more code or if this unplanned, I hope i could help you, if you have any questions just contact me. to reove this mssage Just remove this line from the file (sorry for my poor english, im from germany)
    pause>nul
    exit
     

    Attached Files:

  3. simonfrat123

    simonfrat123
    Expand Collapse

    Joined:
    Jun 16, 2015
    Messages:
    331
    thanks I can now continue making the game
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice