Jump to content
Sign In to follow this  
moleman1546

Autosave mod request

53 posts in this topic Last Reply

Highlighted Posts

Posted:
Last Online: A long, long time ago... 
 

 If you are like me, you love Sim City 4, but hate losing your work when it crashes to desktop.

I was googling around for something and I came across these forums. Everyone was asking for an auto save, but no one had one.

I found a link to this Save Alarm mod:

https://www.sc4devotion.com/csxlex/lex_filedesc.php?lotGET=78

But I didn't want just to be warned, I wanted the game to save automatically. So after not finding anything, I decided to write a simple app that automatically saves the game for you.

You can read about it and download it here:

http://www.thehobbykingdom.com/forum/default.aspx?g=posts&t=3621

Share this post


Link to post
Share on other sites
Posted:
Last Online: A long, long time ago... 
 

I like it. Good idea and will definaly be downloaded.

A few questions:

1) Does it need to be turned on or is it automatic?

2) Will it lagg the game on slower computers? (because the computer i have sim city 4 downloaded on has 80GB HDD 2GB RAM, NVIDEA GEFORCE 2, and its ok considering no lagg for high graphics on sim city.)

 

Share this post


Link to post
Share on other sites
Posted:
Last Online:  
 

DLing right now, awesomest Thing ever, BUT, i know when i save my city in SC4, it takes at least 3 minutes, (for my largest city), will the Game freeze when its saving, or not.

If no, you have truly made a miracle modd. Thank you so much!


Check Out My CJ!

sunderlandg.jpg

Share this post


Link to post
Share on other sites
Posted:
Last Online: A long, long time ago... 
 

Originally posted by: Aro0w

does it work?quote>

Yes, it absolutely 100% works! 

Last night I started up the auto save program and began playing SC4.  Every 10 minutes the screen would pause (5 secs on my computer) and a pop up would say "Saved" and show the file name (just the same as when you save it manually).

After playing SC4 for 4 hours last night, with the auto saver running, IT NEVER CRASHED!  Stupid murphy's law...

Based on last night, I could say the auto save actually prevents crashing! :-)

Share this post


Link to post
Share on other sites
Posted:
Last Online: A long, long time ago... 
 

Originally posted by: Deathcat001

I like it. Good idea and will definaly be downloaded.

A few questions:

1) Does it need to be turned on or is it automatic?

2) Will it lagg the game on slower computers? (because the computer i have sim city 4 downloaded on has 80GB HDD 2GB RAM, NVIDEA GEFORCE 2, and its ok considering no lagg for high graphics on sim city.)

 quote>

1)  You need to run the program I wrote either before or after you launch sim city 4.

Once you launch the auto save program, you need to click the Start Button. 

From that point on it just runs in the background and you don't need to touch it.

After people start using it I'll collect feedback and maybe make a new version.

2)  Despite the ridiculous system requirements I posted (I was mostly kidding) the auto saver does not impact your system at all (in terms of processor, or ram, etc.).  All it does is tell SC4 to save your game every X minutes.  So however long it takes to save the game on your system remains the same. 

This is why I made the save frequency configurable by you the user.  If it takes 3 minutes to save your larger city, maybe you will want it to auto save every 60 minutes instead of every 15.  You can adjust it to whatever you are comfortable with.

Share this post


Link to post
Share on other sites
Posted:
Last Online: A long, long time ago... 
 

Originally posted by: miggoycor

You should upload this to STEX or LEX!quote>

I don't know what those are.

Share this post


Link to post
Share on other sites
Posted:
Last Online: A long, long time ago... 
 

Originally posted by: bluemoose

DLing right now, awesomest Thing ever, BUT, i know when i save my city in SC4, it takes at least 3 minutes, (for my largest city), will the Game freeze when its saving, or not.

If no, you have truly made a miracle modd. Thank you so much!quote>

Sorry to say, yes it does freeze while saving.  It behaves the same as if you clicked Save City yourself.

Share this post


Link to post
Share on other sites
Posted:
Last Online:  
 

Originally posted by: Lord Yabo

Originally posted by: miggoycor

You should upload this to STEX or LEX!quote>

I don't know what those are.

quote>

The STEX is the Simtroplois Exchange, where custom content and mods are uploaded to share, and is found on this website.  The LEX is the same thing except on Sim City 4 Devotion, where you have also made a thread on this mod.  The STEX is open to anyone, but the LEX requires you to apply for it.  Both have rules about file size and such stuff for uploads.  


Share this post


Link to post
Share on other sites
Posted:
Last Online:  
 

A quick question to you... I understand if you don't want to say, but can you give any hint how you did this. It seems all very astounding that SC4 has been out for 6 years now and no one so far has written a code to avert a very well-known and annoying bug, yet you wrote one in a night. Also, as was said on page 1 of this thread, does this tool save the game data and the satellite image, or just game data? Because someone on 1st page suggested that instead of saving both, you save just data with this tool so that save times are brought to a minimum... can you investigate to see if this is possible for a second version?

Nevertheless I will be downloading this immediately. Thank you!

*Edit* I googled an autosave as well and found a blog by someone named "The Real Red" who just created (June 28,2009) an autosave for SC4 - I can see that Lord Yabo saw this as well on the 15th of July and posted a thank-you, saying "Based on ideas in this article I wrote a simpler to install and use C# version." Therefore, I think that if this program does work, credit is due to this "Real Red" as well for writing the base for what would become Lord Yabo's program. Just my $0.02

the-real-red.blogspot.com/2009/06/sim-city-4-crashing-to-desktop-autosave.html << The Real Red's blog

Share this post


Link to post
Share on other sites
Posted:
Last Online: A long, long time ago... 
 

Originally posted by: PattyO

A quick question to you... I understand if you don't want to say, but can you give any hint how you did this. It seems all very astounding that SC4 has been out for 6 years now and no one so far has written a code to avert a very well-known and annoying bug, yet you wrote one in a night. Also, as was said on page 1 of this thread, does this tool save the game data and the satellite image, or just game data? Because someone on 1st page suggested that instead of saving both, you save just data with this tool so that save times are brought to a minimum... can you investigate to see if this is possible for a second version?

Nevertheless I will be downloading this immediately. Thank you!

*Edit* I googled an autosave as well and found a blog by someone named "The Real Red" who just created (June 28,2009) an autosave for SC4 - I can see that Lord Yabo saw this as well on the 15th of July and posted a thank-you, saying "Based on ideas in this article I wrote a simpler to install and use C# version." Therefore, I think that if this program does work, credit is due to this "Real Red" as well for writing the base for what would become Lord Yabo's program. Just my $0.02

the-real-red.blogspot.com/2009/06/sim-city-4-crashing-to-desktop-autosave.html << The Real Red's blog

quote>

In answer to your first question, why if after 6 years no one can do this, the answer is in the edit you mentioned.  Everyone was probably looking for a way to MOD Sim City 4, meaning to work from inside Sim City 4. 

When I saw the Real Red post with the Python script, I was intrigued, because his approach was to address the problem from outside SC4, which is literally out of the box thinking.  His script sends a Ctrl-S via the Win32 API call SendKeys.  This causes SC4 to think you pressed Ctrl-S from your keyboard, and promptly saves your game. 

To use Real Red's script he provides some instructions of crap you have to download and install, which I (nor many people) are interested in doing.  It also has no GUI. 

Though I own a software company and we use SendKeys in our applications, I never thought of that being a solution here.  So kudos to Real Red for the idea.  Hence, what I posted on his blog telling him I took his idea and went further with it.

So, in a nut shell, the program I wrote presses Ctrl-S for you every X minutes, hence an auto-save.

Once I knew the direction to take, i took me about half an hour to write and test the program.  He mentions a problem where his minimizes the UI ingame.  My program has no such issue, which I attribute to a difference between Python and C#.

Hopefully this answers why it could be done in a night.

Share this post


Link to post
Share on other sites
Posted:
Last Online:  
 

Well, that's awesome then. I do have one further suggestion if you feel ambitious.

I don't know where the game saves- if it saves to the game's regular save file, but if possible I think it should save to an autosave file. That way a game won't be permanently automatically saved if the builder does something that they don't want to save (starts a disaster in their city, for instance) and autosave kicks in before they're able to exit out of the city (in case they forget to shut off autosave). I don't know if this is possible (i've never worked with coding or programming, etc) but that would be cool in a 2nd version as well.

Share this post


Link to post
Share on other sites
Posted:
Last Online:  
 

you could just minimize the game and turn the autosave off if you wanted to do some experimentinng.

But wait, it would require me to do work OH NOES!!!!!

3.gif


Check Out My CJ!

sunderlandg.jpg

Share this post


Link to post
Share on other sites
Posted:
Last Online:  
 

A glitch- if pressong shift when the autosave kicks in, the game fails to save and instead goes to the maxis camera thingy, the hotkey is prolly shift-ctl-s

Its unfortunate, and probably unfixable. I happen to use the shift key a lot when zoning, so, i have to watch out


Check Out My CJ!

sunderlandg.jpg

Share this post


Link to post
Share on other sites
Posted:
Last Online:  
 

But y'know what chews me up, is when it crashes on save, so annoying then oher times it just crashes. my pc used to be cool, now it sucks.

Share this post


Link to post
Share on other sites
Posted:
Last Online: A long, long time ago... 
 

I hate sim city restarting and realy like the autosaver but since it overwrites the file and i make a mistake( like accedendally bulldosing the hydrogen power plant 8.gif) and it saves... so i made a backuper so i wont have that problem 2.gif

SC4_BACKUPER.zip

Share this post


Link to post
Share on other sites
Posted:
Last Online:  
 

mii7303

I've downloaded your program & get this error when I try & run it - any ideas?!?

autosave.jpg

Share this post


Link to post
Share on other sites
Posted:
Last Online: A long, long time ago... 
 

Yeah this drove me to my first ever attempt at scripting but I came up with a basic solution that works fine for me. This will start SimCity 4, then every ten minutes will send the keyboard shortcut 'ctrl+s' to force a save. Immediately afterwards it will backup that save to a separate folder and archive the last three saves to minimise loss due to corrupted saved games such as when the game decides to crash during a save. It can cause a little lag for a few seconds after each save but I'm only running an old AM1 dualie and 2gb of DDR1 so it probably won't be an issue for most. The app can be closed manually by right clicking the icon in the taskbar but will shut itself off within ten minutes anyway as soon as it notices that SimCity 4 is no longer running.

1/ Download AutoIt.from here: http://www.autoitscript.com/autoit3/downloads.shtml

2/ Install AutoIt then right click within a folder and select "new" then "AutoIt v3 Script".

3/ Rename the script to whatever you like, then right click and select "edit".

4/ Paste in the following and change the relevant folder paths. Also adjust the second sleep timer if you wish. I's set for ten minutes, time is in milliseconds:

Run ( "C:\Program Files\Maxis\SimCity 4 Deluxe\Apps\simcity 4.exe" )

Sleep(120000)

Do

Sleep(600000)

Send("^s")

DirCopy ( "E:\erch\My Documents\SimCity 4\RegionsBackup\Older", "E:\erch\My Documents\SimCity 4\RegionsBackup\Oldest" , 1 )

DirCopy ( "E:\erch\My Documents\SimCity 4\RegionsBackup\Newest", "E:\erch\My Documents\SimCity 4\RegionsBackup\Older" , 1 )

DirCopy ( "E:\erch\My Documents\SimCity 4\Regions", "E:\erch\My Documents\SimCity 4\RegionsBackup\Newest" , 1 )

Until ProcessExists ("simcity 4.exe") = 0

5/ Click "File", then "Save".

6/ Go to ...\documents\SimCity 4. Create a folder within there named RegionsBackup and within that create three sub-folders named "Newest", "Older" and "Oldest". Your last three saved games can be found in here should you need them.

Hope this helps!

Posted this before I read the second page of the thread lol. Oh well, the archive feature is the one that will probably mean the most to people when it comes to the crunch ;o)

Share this post


Link to post
Share on other sites
Posted:
Last Online: A long, long time ago... 
 

Here's a slight improvement to erchamion92's AutoIt script: 

Dim $MyDocsDir, $Region, $AutoSaveMins, $CurrDir, $NewestDir, $OlderDir, $OldestDir, $CurrMin

$MyDocsDir = "E:\Alicia\My Documents\"
$Region = "SimRegion"
$AutoSaveMins = 10

If StringLen($Region) >0 then $Region = "\" & $Region

$CurrDir = $MyDocsDir & "SimCity 4\Regions" & $Region
$NewestDir = $MyDocsDir & "SimCity 4\RegionsBackup\Newest" & $Region
$OlderDir = $MyDocsDir & "SimCity 4\RegionsBackup\Older" & $Region
$OldestDir = $MyDocsDir & "SimCity 4\RegionsBackup\Oldest" & $Region
 
Run ( "C:\Program Files\Maxis\SimCity 4 Deluxe\Apps\SimCity 4.exe" )
Sleep(120000)
While ProcessExists ("SimCity 4.exe")
  $CurrMin = 0
  While $CurrMin < $AutoSaveMins
    Sleep(60000)

    $CurrMin = $CurrMin + 1

    If Not ProcessExists ("SimCity 4.exe") then ExitLoop
  Wend
  If Not ProcessExists ("SimCity 4.exe") then ExitLoop
  Send("^s")
  DirCopy ( $OlderDir, $OldestDir , 1 )
  DirCopy ( $NewestDir, $OlderDir , 1 )
  DirCopy ( $CurrDir, $NewestDir , 1 )
WEnd

 This version checks for the "SimCity 4.exe" process every minute, to help try to close the script out before you re-launch the game in the event of a crash.

The Variables:

1/ $MyDocsDir, - a single place to put in your My Documents directory to help prevent duplication typos

2/ $Region - A place to specify a single region to back up. If you want to back up them all, set this variable to "". I've included a separate line to add a backslash if necessary.

3/ $AutoSaveMins - As the name implies, the number of minutes you want between your autosaves. 

4/ $CurrDir, $NewestDir, $OlderDir, & $OldestDir - Computed variables based off of the values given in 1 & 2.

Hope this helps! 

Alicia

Share this post


Link to post
Share on other sites

Sign In or register to comment...

To comment in reply, you must be a community member

Sign In  

Already have an account? Sign in here.

Sign In Now

Create an Account  

Sign up to join our friendly community. It's easy!  

Register a New Account

Sign In to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×

Thank You for the Continued Support!

Simtropolis depends on donations to fund site maintenance costs.
Without your support, we just would not be in our 24th year online!  You really help make this a great community. *:thumb:

But we still need your support to stay online. If you're able to, please consider a donation to help us stay up and running. This helps sustain a platform where we can share our community creations for years to come.

Make a Donation, Get a Gift!

Expand your city with the best from the Simtropolis Exchange.
Make a Donation and get one or all three discs today!

STEX Collections

By way of a "Thank You" gift, we'd like to send you our STEX Collector's DVD. It's some of the best buildings, lots, maps and mods collected for you over the years. Check out the STEX Collections for more info.

Each donation helps keep Simtropolis online, open and free!

Thank you for reading and enjoy the site!

More About STEX Collections