|
|
|
|
July 13th, 2005, 07:51 AM
|
|
General
|
|
Join Date: Sep 2003
Location: Tel Aviv, Israel
Posts: 3,465
Thanks: 511
Thanked 162 Times in 86 Posts
|
|
gauging interest. save game perl script
Well not sure why but I never got to actually using the Java dom save utility. I had problems with jre this and classpath that and probably I wasn't patient enough to get it to work.
So after some time of stupidly saving turns by manually copying them I decided to write a small perl script to save turns.
So I did.
It can save and restore turns.
It is configurable.
It is OS independent.
It is CLI (though if there's interest I might add a GUI to it).
I am using it and find it very convenient.
I am trying to gauge if there's interest in this tool.
If so I can upload it, also If there are any suggestions as to how it can be even more useful I can consider and maybe add them.
One use for it that I can imagine is for PBEM hosts - it can be used as an easy way to save all turns.
Usage (from script documentation):
"Usage save_dom.pl [v|c|s|l] [game name] [turn number].
Examples.
1 To save turn 14 of game named "ermor" do:
save_dom.pl s ermor 14.
2 To load turn 14 of game named "ermor" do:
save_dom.pl l ermor 14.
3 To configure values of dominions II path and save game root path do:
save_dom.pl c.
4 To view configuration parameters values do:
save_dom.pl v
"
EDIT,
In the zip file is the perl script (you need to install perl for it to work)
also is a .save_dom_conf file, this is an example of the configuration file on my system.
|
July 13th, 2005, 10:22 AM
|
First Lieutenant
|
|
Join Date: Feb 2005
Posts: 693
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Re: gauging interest. save game perl script
I would download it and check it out, although the java one works fine for me now.
One question: why do you have to give the turn number with the 's' command? Won't it just save the current turn no matter what? Is it that there no easy way for the script to know what the current turn is?
|
July 13th, 2005, 03:42 PM
|
|
General
|
|
Join Date: Sep 2003
Location: Tel Aviv, Israel
Posts: 3,465
Thanks: 511
Thanked 162 Times in 86 Posts
|
|
Re: gauging interest. save game perl script
Quote:
Oversway said:
I would download it and check it out, although the java one works fine for me now.
One question: why do you have to give the turn number with the 's' command? Won't it just save the current turn no matter what? Is it that there no easy way for the script to know what the current turn is?
|
Good question. The truth is I don't know for sure.
The turn # is probably stored in the .2h/.trn file.
If it is stored there then it can be extracted otherwise I'm not sure there's an easy way to know the turn #.
The script could work like a deamon, in the background checking if the turn files are updated and then save them to the correct turn.
only problem is how to know what is the correct turn.
|
July 13th, 2005, 09:53 PM
|
Private
|
|
Join Date: Jul 2005
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Re: gauging interest. save game perl script
I am *TREMENDOUSLY* interested in this heh. I've never used perl.... trying to figure out how to use it now, add a gui .
Edit: Okay i'm lost, how do I use this?
Quote:
Oversway said:
I would download it and check it out, although the java one works fine for me now.
|
What java one?
|
July 14th, 2005, 12:02 AM
|
Corporal
|
|
Join Date: Jan 2004
Location: Wilmington, Delaware, USA
Posts: 191
Thanks: 1
Thanked 13 Times in 2 Posts
|
|
Re: gauging interest. save game perl script
izaqyos,
The turn number is in all of the .2h, .trn, and ftherland files. It's in bytes 15 and 16, low-order byte first.
__________________
No plan survives contact with the enemy.
--Helmut von Moltke
Have too may pretender files to keep track of? Use catgod to view them.
|
July 14th, 2005, 09:29 AM
|
|
General
|
|
Join Date: Sep 2003
Location: Tel Aviv, Israel
Posts: 3,465
Thanks: 511
Thanked 162 Times in 86 Posts
|
|
Re: gauging interest. save game perl script
@Evil Dave, Thanks. I'll modify the script so that the turn # is not needed.
@Slen, I mainly work with C/C++ and JAVA but for quick and dirty stuff they don't come close to Perl.
|
July 14th, 2005, 10:15 AM
|
|
General
|
|
Join Date: Sep 2003
Location: Tel Aviv, Israel
Posts: 3,465
Thanks: 511
Thanked 162 Times in 86 Posts
|
|
Re: gauging interest. save game perl script
@Evil Dave, I used a hex editor to view the .2h and .trn files but I didn't see the turn numbers at all.
|
July 14th, 2005, 10:35 AM
|
|
Shrapnel Fanatic
|
|
Join Date: Oct 2003
Location: Vacaville, CA, USA
Posts: 13,736
Thanks: 341
Thanked 479 Times in 326 Posts
|
|
Re: gauging interest. save game perl script
I dont want to know you out of your project. Its always worthwhile to do something like it. The subject of the thread is "gauging interest. save game perl script" so we can wait and see if enough people are able to run perl scripts who are interested.
But yes, here are a number of versions of a save program. Bat file, java, basic, etc. I was tempted to EXE a basic one so that people didnt have to "download this and install it to run this". You can use the pre-exec and post-exec switches when starting Dom2 to make a save every turn but that doesnt do anything different than the game does without a save.
The icon version with bat files works ok for me. I click the icon to make a save of the game. But you have to reach your desktop to do it and you have to edit the batch file to tell it which game.
What I had in mind for an exe would be something that you clicked which would start the saver program, then start Dom2 with the "status file" switch. That file is ascii and easily parsed with a turn number in it. The exe could "see" the turn changes and make 2, 3, or 5 maybe.. rotating backups that are 5 turns apart from each other.
__________________
-- DISCLAIMER:
This game is NOT suitable for students, interns, apprentices, or anyone else who is expected to pass tests on a regular basis. Do not think about strategies while operating heavy machinery. Before beginning this game make arrangements for someone to check on you daily. If you find that your game has continued for more than 36 hours straight then you should consult a physician immediately (Do NOT show him the game!)
|
July 14th, 2005, 08:23 PM
|
Corporal
|
|
Join Date: Jan 2004
Location: Wilmington, Delaware, USA
Posts: 191
Thanks: 1
Thanked 13 Times in 2 Posts
|
|
Re: gauging interest. save game perl script
Quote:
izaqyos said:
@Evil Dave, I used a hex editor to view the .2h and .trn files but I didn't see the turn numbers at all.
|
I'm using xxd under Mac O/S 10. In a game at 171, the first line of the dump looks like this:
0000000: 0102 0444 4f4d f609 0000 d400 0000 ab00 ...DOM..........
^address ^bytes ^ascii equivalent
I've put the turn number bytes in bold. 0xab == 171 decimal. I hope the save file is the same under all architectures.
__________________
No plan survives contact with the enemy.
--Helmut von Moltke
Have too may pretender files to keep track of? Use catgod to view them.
|
Thread Tools |
|
Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is On
|
|
|
|
|