|
Re: Making a backup of your Stars! turns |
Mon, 17 November 2003 01:12 |
|
|
Hmm.. Hey I've got something that could help this work, you wouldn't even need to put in the year... Though it would require an external exec to read the year off in hex...
However,to do it purely with batch in XP it would probably have to be like this:
@echo off
echo What year is this file?
set /p year=
if "%year%" == "" goto end
md "%year%"
for %%e in (xy x3 m3 h3) do copy gamename.%%e %year%
:end
That should work out for ya... If you wanted to run it every year, it's possible to make it so it "remembers" and can increment for you.. (XP only) Like this:
@echo off
if exist year.bat goto skip
echo What year is this file?
set /p year=
echo set year=%year% > year.bat
:skip
call year.bat
if "%year%" == "" goto end
md "%year%"
for %%e in (xy x3 m3 h3) do copy gamename.%%e %year%
set /a year=%year% +1
echo set year=%year% > year.bat
:end
And that should solve even your input work, assuming you run it every year. (and of course alter the number "3" to your race, and "gamename" to the game name... and you should be JUST FINE!)
If you don't wanna edit the batch file, to add game and race# in use this one:
@echo off
if exist year.bat goto skip
echo What year is this file?
set /p year=
echo Game name?
set /p game=
echo Race number?
set /p race=
echo set year=%year% > year.bat
echo set game=%game%>> year.bat
echo set race=%race%>> year.bat
:skip
call year.bat
if "%year%" == "" goto end
md "%year%"
for %%e in (xy x%race% m%race% h%race%) do copy %game%.%%e %year%
set /a year=%year% +1
echo set year=%year%> year.bat
echo set game=%game%>> year.bat
echo set race=%race% >> year.bat
:end
[Updated on: Mon, 17 November 2003 01:38]
Rule 1: "Pillage, THEN burn!"Report message to a moderator
|
|
|
Re: Making a backup of your Stars! turns |
Mon, 17 November 2003 03:35 |
|
|
There is an exec called staryear.exe that is part of the XChange script that is(was) the basis of AutoHost.
With its /q switch it outputs only the year.
Damned if I can figure out how to make that help tho...haven't really done batch programming in years.
On a related note....does anyone know of an email client that will execute programs within the filter system? Besides Eudora(which is what I'm using...but my batch file only keeps one year backups - it also moves the received file from my attachments dir to my game dir)
[Updated on: Mon, 17 November 2003 03:41] Report message to a moderator
|
|
|
Re: Making a backup of your Stars! turns |
Mon, 17 November 2003 15:20 |
|
|
Yeah I know how to make that one work (not the email thing). Let me see here.... Batch is my only skill at "programming" So now to incorperate the use of staryear.exe.... Automation here we come!
Now assuming you put "Staryear.exe" into the same directory as this batch file... hmmm.... This isn't going to be enough... To convert the output to a useable command I'll need 1 other program. I'll have to post this... But it's really tiny.. (I could do it just with this other program, but it would only work well upto year 2555 then it would start having problems.) It might be possible to do this with a "for" command, but I don't think "for" can weed out those pesky hard returns. Anyway, here we go:
@echo off
if exist player.bat goto skip
echo Game name?
set /p game=
echo Race number?
set /p race=
echo set game=%game%> player.bat
echo set race=%race% >> player.bat
:skip
call player.bat
echo set year=>!.bat
staryear %game%.m%race% /q >>!.bat
poke !.bat 0x9 0xd
poke !.bat 0xa 0xd
call !.bat
md "%year%"
for %%e in (xy x%race% m%race% h%race%) do copy %game%.%%e "%year%"
:end
del !.bat
There's only 1 problem with this, it takes 2 programs to make work.
You can get "poke.exe" out of this file:
http://www.pirates.retreat.btinternet.co.uk/StarNameChanger. zip
And "staryear.exe" out of this file:
ftp://library.southern.edu/xchange.zip
Copy the batch file I have above to *.bat (* being whatever you want) and then extract Staryear.exe and Poke.exe from the 2 files, put them in the same directory as your batch file and VWALLA! Your all ready to go! It'll read the year, make the directories, all you have to do is say what game and what race.. ONCE! Neat eh? I might also be able to whip up one to do multiple players.. maybe.. or you can just edit it, add a few more lines.. whatever.
[Updated on: Mon, 17 November 2003 15:26]
Rule 1: "Pillage, THEN burn!"Report message to a moderator
|
|
|
|
|
|
|
Re: Making a backup of your Stars! turns |
Wed, 17 December 2003 18:10 |
|
|
Hey I just wrote up 1 last batch file here. It requires Poke.exe but so does all my other stars utilities
Improvements: It's faster than the one I had that used Staryear.exe (which used to hang on me.) It can also calculate the year on it's own accurately! WOOT! All you need to do is copy this text into a file with a .bat at the end, and get poke! from my star namer program at Pirates retreat. Run it, adjust it. Whatever. I've also got one that'll save you time when opening your ally's turn files.. You edit in the password and then just drag drop to load the turn! (I didn't include that one here)
@echo off
if exist zgame.bat goto skip
echo Game name?
set /p game=
echo Race number?
set /p race=
echo set game=%game%> zgame.bat
echo set race=%race% >> zgame.bat
:skip
call zgame.bat
echo set year=>!.bat
::staryear %game%.m%race% /q >>!.bat
poke %game%.m%race% 0xc >>!.bat
poke !.bat 0x9 0xd
poke !.bat 0xa 0xd
call !.bat
set year1=%year%
echo set year=>!.bat
poke %game%.m%race% 0xd >>!.bat
poke !.bat 0x9 0xd
poke !.bat 0xa 0xd
call !.bat
set year2=%year%
set /a year=(year2 *256) +year1
set /a year=year +2400
md "%year%"
for %%e in (xy x%race% m%race% h%race%) do copy %game%.%%e "%year%"
:end
del !.bat
=====================
And as a special bonus! here's one that'll auto detect how many player M files you have and auto back them up for you! (still requires POKE.exe)
=====================
@echo off
if exist zgame.bat goto skip
echo Make sure any races you want backed up are present in the directory.
echo .
echo Game name?
set /p game=
echo set game=%game%> zgame.bat
set num1=1
set num=0
:loop1
if exist %game%.m%num1% set /A num=num +1
if exist %game%.m%num1% echo set race%num%=%num1% >> zgame.bat
if %num1%==16 goto next
set /A num1=num1 +1
goto loop1
:next
echo set num=%num% >> zgame.bat
:skip
call zgame.bat
set race=%race1%
echo set year=>!.bat
poke %game%.m%race% 0xc >>!.bat
poke !.bat 0x9 0xd
poke !.bat 0xa 0xd
call !.bat
set year1=%year%
echo set year=>!.bat
poke %game%.m%race% 0xd >>!.bat
poke !.bat 0x9 0xd
poke !.bat 0xa 0xd
call !.bat
set year2=%year%
set /a year=(year2 *256) +year1
set /a year=year +2400
md "%year%"
copy %game%.xy "%year%"
for %%e in (%race1% %race2% %race3% %race4% %race5% %race6% %race7% %race8% %race9% %race10% %race11% %race12% %race13% %race14% %race15% %race16%) do copy %game%.?%%e "%year%"
copy !trade* %year%
:end
del !.bat
[Updated on: Wed, 17 December 2003 22:06]
Rule 1: "Pillage, THEN burn!"Report message to a moderator
|
|
|