1.

Solve : Possible Idea?

Answer»

My game currently loads THINGS by checking if the file is there and if it is then setting a variable to certain value.

I am wondering if you could make one text file that contains DIFFERENT information on each line, for EXAMPLE:
Code: [Select]Jacob
MP5
Level 3
And then make the batch file read from one line e.g the second line.
then set a variable to what the second line contained.
For Example:
- Batch file reads second line of jacob.txt
- Batch file sets the second line of data to %weapon%.
- Batch file then echos %weapon%

I want to know if this is possible, and if so how to do it.

The only good thing about my system at the moment is it only loads the guns that i specify so people cannot enter their own guns.

thank you.

You can have something like this:

file1.bat
Code: [Select]set name=Jacob
set weapon=MP5
set level=level 3
file2.bat
Code: [Select]call file1.bat
echo %weapon%
pauseQuote from: Carbon Dudeoxide on June 07, 2008, 04:07:01 AM

You can have something like this:

file1.bat
Code: [Select]set name=Jacob
set weapon=MP5
set level=level 3
file2.bat
Code: [Select]call file1.bat
echo %weapon%
pause

How would i get the game to output the data into file1.bat please.
Honestly, batch isn't one of my strongest areas but I've had a lot of experience with it.
Try this (as an idea):

file1.bat
Code: [Select]set name=Jacob
set weapon=MP5
set level=3
file2.bat
Code: [Select]@echo off
call file1.bat
echo Hello %name%, you are using an %weapon% and you are currently on level %level%.
pause
cls
echo please enter your name
set /p name= :
cls
echo Please enter a weapon
set /p weapon= :
cls
echo Please enter a level number
set /p level= :
cls
del file1.bat
echo set name=%name%>>file1.bat
echo set weapon=%weapon%>>file1.bat
echo set level=%level%>>file1.bat
echo Successfully saved
pause
exit
Side NOTE: you don't need the ':' when using the set command (set /p level= :). I just put it there because I think it looks better.Quote from: Carbon Dudeoxide on June 07, 2008, 04:15:01 AM
Honestly, batch isn't one of my strongest areas but I've had a lot of experience with it.
Try this (as an idea):

file1.bat
Code: [Select]set name=Jacob
set weapon=MP5
set level=3
file2.bat
Code: [Select]@echo off
call file1.bat
echo Hello %name%, you are using an %weapon% and you are currently on level %level%.
pause
cls
echo please enter your name
set /p name= :
cls
echo Please enter a weapon
set /p weapon= :
cls
echo Please enter a level number
set /p level= :
cls
del file1.bat
echo set name=%name%>>file1.bat
echo set weapon=%weapon%>>file1.bat
echo set level=%level%>>file1.bat
echo Successfully saved
pause
exit
Side note: you don't need the '[glow]:[/gow]' when using the set command (set /p level= [glow]:[/gow]). I just put it there because I think it looks better.

Thanks, But I'll keep my old way as it took a good week to perfect.
And it will take a long TIME to incorporate this successfully.
Thanks.
No problem. (again)


Discussion

No Comment Found