Save & Load Test

For questions about using Classic.

Post » Tue Oct 23, 2012 3:24 am

Here is the .cap: https://rapidshare.com/files/625898342/Save%20Load%20Test.zip

Using Deadeyes ISO .cap, I'm trying to do a Save & Load Test using the Save & Load function. Here is what's happening:

Layout 1

In the first layout, the black rectangle loads a save when you click it, and when you click on the red rectangle it makes a save of the positions of the objects you drag and drop inside the layout and carries it over to the next layout. So in a way, this acts like a layout editor at runtime.

Layout 2

In this layout, anything you drag and drop is meant to be temporary, and when you go back to Layout 1 all the positions of the objects should be back where you originally left them in Layout 1. So essentially, this is trying to make Layout 2 a runtime... at runtime :-) but the problem is...

-When I click on the blue rectangle to take me back to Layout 1, it goes back to Layout 1 but the objects retain the positions made in Layout 2. The positions in Layout 2 were only supposed to be temporary.

-When I click on the black rectangle to load the save, it's supposed to start on Layout 1, but it jumps to Layout 2. The only thing that goes right is that it saves the correct positions, it's just that it puts them in the wrong layout! :-(

Two more things

Does anyone know what the file type of the save file is? I'm on XP and the file type doesn't show, it just says "file" under file type.

AND...

Does anyone know which plugins don't work with the Save & Load function? I haven't encountered any yet but I read that some plugins don't Save & Load.MrMiller2012-10-23 15:24:07
B
12
S
4
G
3
Posts: 426
Reputation: 2,458

Post » Thu Oct 25, 2012 8:22 pm



Anyone?
B
12
S
4
G
3
Posts: 426
Reputation: 2,458

Post » Thu Oct 25, 2012 9:44 pm

[quote]-When I click on the blue rectangle to take me back to Layout 1, it goes back to Layout 1 but the objects retain the positions made in Layout 2. The positions in Layout 2 were only supposed to be temporary.[/quote]
The objects are global so they keep the same position from layout to layout. You could try to reload when you go to layout 1.

[quote]-When I click on the black rectangle to load the save, it's supposed to start on Layout 1, but it jumps to Layout 2. The only thing that goes right is that it saves the correct positions, it's just that it puts them in the wrong layout! :-([/quote]
This makes solution 1 not work, so I would say this would be a good situation to do your own save/load system.

[quote]Does anyone know what the file type of the save file is? I'm on XP and the file type doesn't show, it just says "file" under file type.[/quote]
It's a Construct game state file, only readable by the game that made it.

[quote]Does anyone know which plugins don't work with the Save & Load function? I haven't encountered any yet but I read that some plugins don't Save & Load.
[/quote]
Only the sine behavior comes to mind.


There are examples elsewhere on the forum of custom save and load, the S plugin can be helpful in this aspect.

Here is a simple save/load that will work for your example:
http://dl.dropbox.com/u/5426011/examples15/simple_save_load.cap
B
79
S
24
G
54
Posts: 4,738
Reputation: 40,739

Post » Fri Oct 26, 2012 12:32 am

Hi Rojo,

Thanks for tackling this!

[QUOTE=R0J0hound]
The objects are global so they keep the same position from layout to layout.[/quote]

Yeah, that's exactly what I want it to do, with the addition of being able to have the objects return to the previous positions they were in in Layout 1.

[QUOTE=R0J0hound]You could try to reload when you go to layout 1.[/quote]

Do you mean manually, or through events?

When I've tried it manually the program just sends me to Layout 2 when I click the black loading button. When I've tried to do it through events where I try to get a load and a layout jump at the same time, the program refuses to do either and I'm stuck on the same layout :-(

I really need it to reset automatically, but I figured that if I can't at least get it to stay on Layout 1 when I click load there is no reason to even try tackling the auto load function yet.


[QUOTE=R0J0hound]This makes solution 1 not work, so I would say this would be a good situation to do your own save/load system.[/quote]

I created an .ini Save/Load system last year, it worked great. But my hard drive crashed since then and I no longer have the old file. To make matters worse, I can't even remember how I did it, lol :-(

The other thing I worry about is how the system will handle loading and saving duplicate sprites like how you'd have a lot of when laying ground tiles for a platform game. The save/load function in events would obviously do it naturally but I'm not sure of how to go about it using an .ini save system. If I can do it like a level loader where sprite positions are read from the .ini file at runtime then that would take care of positioning at least, but I forget how to save plugin parameters and such.


[QUOTE=R0J0hound]
It's a Construct game state file, only readable by the game that made it.[/quote]

Right, but I was trying to find out what the file extension is. I can't find it.

[QUOTE=R0J0hound]

Here is a simple save/load that will work for your example:
http://dl.dropbox.com/u/5426011/examples15/simple_save_load.cap[/QUOTE]

Yeah, I could already do that with my current setup if I only use one Layout. I actually originally did that, but I need two layouts; one to use as an editing board, and the second to use as a fake 'runtime' of the editing board.
B
12
S
4
G
3
Posts: 426
Reputation: 2,458

Post » Fri Oct 26, 2012 5:48 pm

It's a bug that it goes to the second layout when loading. That's why it's a good idea to do your own save/load system. You can use my example for any layout, just include the events in each layouts event sheet and change the "on button clicked" events to "on loop" events so you can call the save/load event from anywhere with the "Start loop" action.

When you go back to layout 1 reload with events so the changes from event 2 are discarded. The save files the save/load actions use have no extension.
B
79
S
24
G
54
Posts: 4,738
Reputation: 40,739

Post » Fri Oct 26, 2012 7:00 pm

Ah. Thank goodness it's just a bug. I wasn't sure at all.

I'm going to do what you said. I was at first going to try making an .ini save system again, but I don't see a way to properly send and receive info between the .ini and cap/exe for multiple duplicated sprites unless there were a way to have each duplicate sprite count itself as a unique sprite. I remember there being a plugin for unique sprites, but I'm not sure if that would be something to solve the issue or not. I'll have to check that out.

Thanks again, Rojo!
B
12
S
4
G
3
Posts: 426
Reputation: 2,458


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 3 guests