Autosave mod help

Hi;
I’m wanting to make an AutoSave mod so that the game saves regularly during the alpha so that people don’t loose everything because they have saved recently.

Although there is a big problem,
I don’t know how to approach creating the modification.I have unzipped the stonehearth.zip ,had an explore around and looked at some of the files.
I would appreciate it if someone could point me into the right direction of how to make this modification.
Below is a list of all the features I wish this mod to cover.
Mod Points:

  • Allow the user to toggle auto save on and off
  • Allow the user to set their own time interval
  • Shows ‘Game Saved’ message in message area
  • Will overwrite the current save file
  • Have own GUI (if necessary)

Thanks for your time,
Hantoo

2 Likes

This is a great idea :wink:

How much pointing do you want? I actually liked the idea enough I went and implemented most of what you discussed. I also added a quick save hot key.

Auto Saving works similar to Fallout 3, where the auto-save is shared between all saves.

Currently the autosave directory is located $(stonehearth_install_path)/saved_games/autosave. In theroy it would be possible to add a few different auto-saves and cycle between them. This is something else Fallout 3 did.

As for the quick save hot key, I tied it to ‘Tab’, for whatever reason. The way this works is the first time the player uses quick save a new save entry is created, from this point on any other quick save will overwrite that data.

As of now their is a small bug, in that the auto-save maintains it’s self on top of the save entry list, reguardless of if it’s the last modified save. I think this has something to do with how I’m getting the date and time. The normal save functions begin on the html/js side of things, my code is on the lua side. Therefore I used lua functions to get at the time and date. I’m sure it can be worked out though. :wink:

To me it’s a lot of fun messing around with Stonehearth, especially on the modding side. As I said before, how much pointing do you want? Is this something you’d like to figure out on your own, with a little help, or would you like my work I’ve done so far, so that you can extend it to fit the rest of your concept.

Let me know :slight_smile:

6 Likes

Hi Honestabelink;
I’m really glad that you liked the idea of autosaving. I think that its especially important to have in alphas and betas when there are loads of bugs and crashes that occur.
I first learnt LUA ages ago when I was playing Roblox, and even that wasn’t proper LUA. However that was a few years ago so i’m still trying to remember stuff and re-teach my self LUA.

If possible could I view your current code to see how you made this mod and how it used the implemented features of StoneHearth. I’m currently very new to modding games so it would be amazing to see how you made this mod :smile:

Thanks again Honestabelink :wink:
Hantoo

Dude, do you ever stop? :smiley:

Nice work!

1 Like

Here you go, :slight_smile:

Anyone planning on using this as a mod must rename the download to autosave.smod.

As a side note, the auto-saving it set to happen every 5 minutes. I never tested with such a long wait time, I hope the timers allow for it. Other than that possible but unlikely snag we should be good to go.

If you have any questions let me know :wink:

Edit

Quick Save key is ‘Tab’

6 Likes

Ingenuous! :wink:
Your knowledge of LUA is far beyond what I know. Thanks ever so much for the code, it always helps to analysis someone elses code and see how they did it.

Thanks for making the mod :smile:

P.S. whats the best way to learn LUA and how Stonehearth uses LUA? Codeacademy? Watch the streams?

1 Like

omg you’re my new idol @honestabelink :smiley: !

On a side note, I don’t know if this mod would help against the ‘deleted saves’ bug. It’s super useful for people who forget saving and have crashes, but I’m worried for the people who’s getting the bug. Luckily we’re getting more information recently about when it happens and such. :blush:

2 Likes

The best experience is doing. One of the best learning source is others work. I would only suggest this if you have some basic knowledge, otherwise I’d recommend getting some background knowledge first.

You don’t just have to learn lua, all programming languages basically go back to the same root subjects, variables, functions, ect. Learning one proficiently will help with others. If you have the interest I would try learning something like C#. It’s very simple and straight forward and easy to get into, compared to say C++.

Here’s Microsofts IDE, it’s free and feature complete, note they have older version’s if you are running Vista and below.

I have never watched them but Jamie King on youtube has videos on the C#.

Fundamentals

Types

Generics

And many more. Overall the Internet is riddled with tutorial C# videos, find someone you enjoy watching.

Lua is different from C# but your understands will carry over.

http://stackoverflow.com/ is my main resource when stuck trying to figure something out.

Programming in my opinion can be difficult to get started in, but once you’ve gotten over the initial hurdle everything should come relatively naturally.

Normally I don’t like to push my own software, but

http://discourse.stonehearth.net/t/lua-unminifier-formatter-improved/

I use this to look through Stonehearth lua files. The main thing it does is format the minified files, making them much more readable. It also supports searching for text, and provides highlighting. Overrall it has some problems, but I currently use it everytime I go to do work on Stonehearth.

Best of Luck :wink:

My hope is that because my code never calls any of the delete save functions, and re-uses save keys, that the ‘deleted saves’ bug wont be an issue. I can’t say for sure though. But thanks for the concern :wink:

5 Likes

great work on the autosave :man_with_gua_pi_mao:

How do you guys think an auto save feature will work out? I’ve lost 3 hours of building several times to crash bugs :disappointed_relieved:

I don’t know if the autosave mod is still working, but you could give it a try if you want:

1 Like