1.

Solve : How to save values in your game??

Answer»

please i need any way to make the users can save the game

for example:

i need to make option in the game "press 1 to save and exit"
if the user pressed 1 .. i need the game saving the values
and if he start the game again i want the game start from his saved point

ThanksContact the SUPPORT department of the creator of the game.

goggle [ " The game name" ] to find the home site for the game.
Code: [Select]D:\batch>set $score=100&set $hitpoints=80

D:\batch>set $
$hitpoints=80
$score=100

D:\batch>set $>savegame.txt

D:\batch>type savegame.txt
$hitpoints=80
$score=100

D:\batch>set $hitpoints=&set $score=

D:\batch>set $
Environment variable $ not defined

D:\batch>for /f "tokens=*" %a in (savegame.txt) do @set %a

D:\batch>set $
$hitpoints=80
$score=100
study this, and you will get the idea
to save game current state: set $>savegame.txt
to load game state: for /f "tokens=*" %a in (savegame.txt) do set %a
Sorry, I didn't got it

Look!

This is the batch game

Could someone make me an option name "Save and Exit"

And if the user Choose it .. i need the game saving the values
and if he start the game again i want the game start from his saved point

Thanks


Quote

@echo off
color f0
:MUSIC
cls
title Music
echo Which genre of music do you want to listen to?
echo .
echo Rock ?
echo Techno ?
echo Electro ?
echo Metal ?
echo I don't want to listen to music...
set /p option=
if '%option%'=='Rock' goto :ROCK
if '%option%'=='Techno' goto :TECHNO
if '%option%'=='Electro' goto :ELECTRO
if '%option%'=='Metal' goto :METAL
if '%option%'=='Idon'twanttolistentomusic' goto :LEAVE

:ROCK
cls
title Rock songs (Music)
echo From which ARTIST?
echo.
echo 3 doors down
echo or... go back?
set /p option=
if '%option%'=='3doorsdown' goto :3DOORSDOWN
if '%option%'=='goback' goto :MUSIC

:3DOORSDOWN
cls
title artist : 3 doors down (Music)
echo Which song do you want to listen?
echo.
echo Kryptonite
echo or... go back?
set /p option=
if '%option%'=='Kryptonite' start Kryptonite.mp3
if '%option%'=='goback' goto :ROCK

:TECHNO
cls
title Techno songs (music)
echo From which artist?
echo.
echo Bart B More
echo Sharon Den
echo Dave Lambert
echo D-Rashid
echo John Dahlback
echo Crookers
echo Kosheen
echo Laidback Luke
echo Eyerer
echo or... go back?
set /p option=
if '%option%'=='BartBMore' goto :BARTBMORE
if '%option%'=='SharonDen' goto :SHARONDEN
if '%option%'=='DaveLambert' goto :DAVELAMBERT
if '%option%'=='D-Rashid' got -RASHID
if '%option%'=='JohnDahlback' goto :JOHNDAHLBACK
if '%option%'=='Crookers' goto :CROOKERS
if '%option%'=='Kosheen' goto :KOSHEEN
if '%option%'=='LaidbackLuke' goto :LAIDBACKLUKE
if '%option%'=='Eyerer' goto :EYERER
if '%option%'=='goback' goto :MUSIC

:BARTBMORE
cls
title artist : Bart B More (Music)
echo Which song?
echo.
echo Erasmus
echo or...go back?
set /p option=
if '%option%'=='Erasmus' start Erasmus.mp3
if '%option%'=='goback' goto :TECHNO

:SHARONDEN
cls
title artist : Sharon Den (Music)
echo Which song?
echo.
echo In and Out o Love (REMIX)
echo or... go back?
set /p option=
if '%option%'=='InandOutofLove (REMIX)' start In.and.Out of.Love.(REMIX).mp3
if '%option%'=='goback' goto :TECHNO

:DAVELAMBERT
cls
title artist : Dave Lambert (Music)
echo Wich song?
echo .
echo House In Play
echo or... go back?
set /p option=
if '%option%'=='HouseInPlay' start House.In.Play.mp3
if '%option%'=='goback' goto :TECHNO

-RASHID
cls
title artist : D-Rashid (Music)
echo Which song?
echo .
echo Latin Brutality
echo or... go back
set /p option=
if '%option%'=='LatinBrutality' start Latin.Brutality.mp3
if '%option%'=='goback' goto :TECHNO

:JOHNDAHLBLACK
cls
title artist : John Dah Black (Music)
echo Which song?
echo .
echo Pyramid
echo or... go back
set /p option=
if '%option%'=='Pyramid' start Pyramid.mp3
if '%option%'=='goback' goto :TECHNO

:CROOKERS
cls
title artist : Crookers (Music)
echo Which song?
echo .
echo Day N Nite
echo or... go back
set /p option=
if '%option%'=='DayNNite' start Day.N.Nite.mp3
if '%option%'=='goback' goto :TECHNO

:KOSHEEN
cls
title artist : Kosheen (Music)
echo Which song?
echo .
echo Hide U
echo or... go back
set /p option=
if '%option%'=='HideU' start Hide.U.mp3
if '%option%'=='goback' goto :TECHNO

:LAIDBACKLUKE
cls
title artist : Laidback Luke (Music)
echo Which song?
echo .
echo BREAK The House Down
echo or... go back
set /p option=
if '%option%'=='BreakTheHouseDown' start Break.The.House.Down.mp3
if '%option%'=='goback' goto :TECHNO

:EYERER
cls
title artist : Eyerer (Music)
echo Which song?
echo .
echo Babylon
echo Electric
echo or... go back
set /p option=
if '%option%'=='Babylon' start Babylon.mp3
if '%option%'=='Electric' start Electric.mp3
if '%option%'=='goback' goto :TECHNO

:ELECTRO
cls
tilte Electro songs (music)
echo From wich artist?
echo.
echo Unknown
echo Dj Bam Bam
echo Dj NMeSiS
echo Gala
echo Mysto
echo Mr Oizo
echo Private Fiction
echo or... go back?
set /p option=
if '%option%'=='Unkown' goto :UNKNOWN
if '%option%'=='DjBamBam' goto :DJBAMBAM
if '%option%'=='DjNMeSiS' goto :DJNMESIS
if '%option%'=='Gala' goto :GALA
if '%option%'=='Mysto' goto :MYSTO
if '%option%'=='PrivateFiction' goto :PRIVATEFICTION
if '%option%'=='MrOizo' goto :MROIZO
if '%option%'=='goback' goto :MUSIC

:UNKNOWN
cls
title artist : Unknown (Music)
echo Which song?
echo .
echo Best Electronic House Tune April 2008
echo Best of Electro 2009
echo DIRTY ELECTRO HOUSE MIX OCTOBER 2008
echo Electro House NEW MiX 2008
echo Electro House NEW MiX 20081
echo House Electro Progressive Club Mix January 2008
echo I LOVE ELECTRO
echo or... go back?
set /p option=
if '%option%'=='BestElectronicHouseTuneApril2008' start Best.Electronic.House.Tune.April.2008.m p3
if '%option%'=='BestofElectro2009' start Best.of.Electro.2009.mp3
if '%option%'=='DIRTYELECTROHOUSEMIXOCTOBER2008' start DIRTY.ELECTRO.HOUSE.MIX.OCTOBER.2008.mp 3
if '%option%'=='ElectroHouseNEWMiX2008' start Electro.House.NEW.MiX.2008.mp3
if '%option%'=='ElectroHouseNEWMiX20081' start Electro.House.NEW.MiX.20081.mp3
if '%option%'=='HouseElectroProgressiveClubMixJanuary20 08' start House.Electro.Progressive.Club.Mix.Janu ary.2008mp3
if '%option%'=='ILOVEELECTRO' start I.LOVE.ELECTRO.mp3
if '%option%'=='goback' goto :ELECTRO

:DJBAMBAM
cls
title artist : Dj Bam Bam (Music)
echo Which song?
echo .
echo The Love I Lost
echo or... go back
set /p option=
if '%option%'=='TheLoveILost' start The.Love.I.Lost.mp3
if '%option%'=='goback' goto :ELECTRO

:DJNMESIS
cls
title artist : Dj NMeSiS (Music)
echo Wich song?
echo .
echo EleCtro HouSe MiX GeNeRaTioN
echo or... go back
set /p option=
if '%option%'=='EleCtroHouSeMiXGeNeRaTioN' start EleCtro.HouSe.MiX.GeNeRaTioN.mp3
if '%option%'=='goback' goto :ELECTRO

:GALA
cls
title artist : Gala (Music)
echo Which song?
echo .
echo Electro Remix 2007
echo or... go back
set /p option=
if '%option%'=='ElectroRemix2007' start Electro.Remix.2007.mp3
if '%option%'=='goback' goto :ELECTRO

:MYSTO
cls
title artist : Mysto (Music)
echo Which song?
echo .
echo Love Lockdown
echo or... go back
set /p option=
if '%option%'=='LoveLockdown' start Love.Lockdown.mp3
if '%option%'=='goback' goto :ELECTRO

:MROIZO
cls
title artist : Mr Oizo (Music)
echo Wich song?
echo .
echo Flat Beat
echo or... go back
set /p option=
if '%option%'=='FlatBeat' start Flat.Beat.mp3
if '%option%'=='goback' goto :ELECTRO

:PRIVATEFICTION
cls
title artist : Private Fiction (Music)
echo Which song?
echo .
echo LIBERTY
echo or... go back
set /p option=
if '%option%'=='LIBERTY' start LIBERTY.mp3
if '%option%'=='goback' goto :ELECTRO

:METAL
cls
title Metal songs (music)
echo .
echo Sorry ther are no song in this genre of music
echo go back?
set /p option=
if '%option%'=='goback' goto :MUSIC

:LEAVE
cls
title leave
echo Are you SURE you want o leave?
set /p option=
if '%option%'=='yes' goto :BYE
if '%option%'=='no' goto :MUSIC

:BYE
cls
echo Bye, see you later
echo .
echo .
echo .
echo MADE by Shani Wuyts
pause

i dont' see any saveable value
where is the game??Please

Is there someone can help me?Quote from: Hallucination on June 02, 2009, 03:16:11 PM
Please

Is there someone can help me?
Just some things I noticed while glancing at it.

1. I suggest replacing all instances of IF with IF /I incase someone writes something like 3DOORSdown...
2. Add set option=%option: =% before the IF /I incase they add spaces...
3. You don't need the colon after goto, only before the label.
4. Adding a loop before choosing an option will prevent someone from entering something stupid like BLAH! and continuing on with the script.
Code: [Select]:loop1
echo Option 1
echo Option 2
set /p option=
set option=%option: =%
if /i "%option%"=="Option 1" goto option1
if /i "%option%"=="Option 2" goto option2
cls
echo Not a valid option!
goto loop1
:option1
code...
:option2
code...
Could you please edit my batch file and add an option
if user pressed "mm" any time batch file - save everything
and if user pressed "nn" any batch - batch file load last save

Thankswell now we'll be taking all the fun away from you Quote from: BatchFileBasics on June 03, 2009, 07:38:14 PM
well now we'll be taking all the fun away from you
Yeah...and the only way you can truly learn is from doing it by yourself. (Trial and error...trial and error)


Discussion

No Comment Found