Well I believe Lief is suggesting using gE's built in saving system. In that case you need to declare an array. To do so go into the script editor click [Variables] and [Add]. Type in the name of your variable, in this case I'd suggest something along the lines of month_array. It's by default set to be an int, now set it to be an array (change the [No] to a [Yes] and give it a size). In this case you'll want the size of the array to be 31 (assuming there is only one month). Last thing you need to do to create the array is to add it into a save group. So type in calender.
Now, in the cross' create actor you can add this code.
cross -> Create Actor -> Script Editor
- Code: Select all
month_array[creator.cloneindex]=1; // this means an x is on that day
And when you destroy the cross you can add this.
cross -> Destroy Actor -> Script Editor
- Code: Select all
month_array[creator.cloneindex]=0; // no x on the day
The idea behind this is that each day is represented by a sub in the month_array variable (it holds 31 possible days). When you click on a day, it sets the corresponding sub to 1, signifying that a cross has been put on that day. Destroying the cross removes it (sets the value back to 0).
Now that we have a way of tracking which days have been clicked, we can go to save it. I assume you want to save when you exit, so wherever you do choose to exit the game, you can add this.
- Code: Select all
saveVars("calender", "calender"); // saves the variables in the calender save group into a file called calender
And when you load your game you want it to load the variables, so in the view's create actor, you can use the reverse operation loadVars.
view -> Create Actor -> Script Editor
- Code: Select all
loadVars("calender", "calender");
And finally the actual recreating of the crosses. Since we were using cloneindex to determine which days had the cross, might as well use it again. In the actual days (the ones you click to create the crosses) add something like this to their create actor event.
day_display -> Create Actor -> Script Editor
- Code: Select all
if(month_array[cloneindex]==1) // if this day had a cross on it
{
//put your CreateActor function call here to create the cross on the day
}