jeudi 28 janvier 2016

auto save and reading text file and converting letters inside into numbers then implementing math to have an outcome

This is a short silly game that is incomplete its for every one to look at and learn from you can do whatever you want with it. This taught me how to auto save and open a file and change the contents inside to become a mathematically equation which changes the outcome of the end of game.

 @echo off
path (where batch file is example C:\desktop)


:title 
cls
echo adventure of boring rpg 
echo 1 new game
echo 2 continue
echo 3 quit 
echo follow me on twitter @MichaelSM1313 
echo (If you like anime, videogames and just being a nerd in general)
echo yes this is not a great game it purpose is meant for teaching or adding
echo on to 
echo.
SET /P input=Type 1 2 or 3 then Press ENTER:
IF %input%==1 GOTO :start adventure
IF %input%==2 GOTO :checkpoint
IF %input%==3 GOTO :quit
echo "%input%" is not a valid option. 
echo
GOTO :title

:checkpoint
set /p checkpoint=<checkpoint.txt
if "%checkpoint%" EQU "" goto :start adventure
goto :%checkpoint%
pause>nul


:start adventure
set A=0
set B=0
cls
echo one day you are at the office 
echo then your project manager gives you a stack of papers 
pause


:stack of papers
cls
echo what do you do?
echo ---------------
echo 1-do papers
echo 2-don't do papers
SET /P input=Type 1 or 2 the Press ENTER:
echo 1-do papers
echo 2-don't do papers
IF %input%==1 GOTO :complete 
IF %input%==2 GOTO :fail 

:complete
cls
set A=1
echo A=1 > ending.txt
echo you keep you job 
pause
goto :raise 

:fail 
cls
echo B=1 > ending.txt
echo you loose you job 
pause
goto :home

:raise 
echo raise>checkpoint.txt
cls
echo you got a raise and the boss asks you if you can become project lead 
echo ---------------
echo 1-become project lead 
echo 2-don't become project lead 
SET /P input=Type 1 or 2 the Press ENTER:
echo 1-become project lead 
echo 2-don't become project lead 
IF %input%==1 GOTO :PM
IF %input%==2 GOTO :NPM

:PM 
cls
set /a A=%A%+1
echo A=%A% >> ending.txt
echo your a PM
pause
goto :home

:NPM
cls
set /a B=%B%+1
echo B=%B% >> ending.txt
echo You get fired
pause
goto :home

:home 
echo home>checkpoint.txt
cls
echo what do you do?
echo ---------------
echo 1-look for job 
echo 2-go for walk 
SET /P input=Type 1 or 2 the Press ENTER:
echo 1-look for job 
echo 2-go for walk 
IF %input%==1 GOTO :job
IF %input%==2 GOTO :walk

:job 
cls 
echo you search for a job 
goto :badorgood

:walk
cls
echo you find a help wanted sign
goto :badorgood

:badorgood
echo. & pause>nul
::echo A=%A% B=%B% 
::for /f %%i in (ending.txt) set %%i
::pause>nul
if %A% GTR %B% ( goto :good ) else ( goto :bad )


:good
cls
echo you live a happy life 
pause & goto title

:bad
cls
echo you live a unhappy life
pause & goto titleenter code here

Aucun commentaire:

Enregistrer un commentaire