Hi! Welcome to the forum for Platinum Arts Sandbox Free 3D Game Maker. I currently have the forums locked as I am attempting to properly update them.

In the meantime please join the new Discord Server!

If you have any questions please e-mail me through the Platinum Arts website.

On Exit Save!

Have any cool screenshots and/or projects to show off? Post your content here!
(If you need somewhere to post your images, why not use our gallery?)
Locked

What do you think?

Amazing (Best)
1
50%
Good
1
50%
Average
0
No votes
Bad
0
No votes
Useless (Worst)
0
No votes
 
Total votes: 2

User avatar
Leo_V117
Support Team
Support Team
Posts: 1640
Joined: February 16th, 2010, 8:00 pm
Name: Leo
IRC Username: Leo_V117
Location: That one place...
Contact:

On Exit Save!

Post by Leo_V117 »

Hey guys... Its been a while since I sent you any code... My autosave code was a big Hit... but this one will be better...

Okay... Heres what you do... find your menus.cfg in the language folder... example: data/lang/en/menus.cfg

Locate this piece of code:

Code: Select all

main = [
	guilist [
		if (= $editing 1) [
			guilist [
				guibutton "Newmap"		"showgui newmap"
				guibutton "Savemap"		"showgui savemap"
				guibar
				guibutton "Test Map"		"edittoggle"
				guibar
	 			guibutton "New particle"	"showgui newparticles"
				guibutton "New light"		"showgui newlight"
				guibutton "New Mapmodel"	"showgui mapmodels"
				guibutton "Find Entities (F5)"	"showgui entfind"
				guibutton "Editing GUI"		"showgui editing"
				guibutton "Skybox menu (F4)"	"showgui skies"
				guibutton "Edit Materials"	"showgui materials"
				guibutton "Quickedit Menu (F3)"	"showquickgui"
				guibutton "Texture Menu (F2)"	"showtexgui"
			]
			guibar
		]
Directly below this part:

Code: Select all

				guibutton "Texture Menu (F2)"	"showtexgui"
add this:

Code: Select all

				guibutton "Quit"	[savemap $mapactionname; echo "Saving!"; sleep 4000 [echo "Saved!"]; sleep 5000 [quit]]	exit
Then save the file.

To test it. Open a new map and create a wall... then save it as "test_quit" and create another wall... select the new "quit" option directly below the "Texture Menu" option. Hopefully a message will show saying "Saving!" then, shortly afterwards... it will say "Saved!" and close the game...

Let me know what you think, it took a little tweaking here and there but it now works.

Inspired by GR1M.
User avatar
Runescapedj
Member
Member
Posts: 1706
Joined: January 9th, 2010, 9:06 am
Name: Michiel
IRC Username: Sandboxdj
Location: Deventer, the Netherlands

Re: On Exit Save!

Post by Runescapedj »

srry, I haven't tested it yet, but can you make it so that it asks for overwriting (like when changing maps and forgot to save on another name before you quit, I can't see it in your code) and maybe you can make it automaticly overwrite when you save the same map as before, just only ask if you load a map or create a new map, so we don't have 2 much MB's of maps that're saved 2 much (I had a map with like 1000 saves, didn't overwrite, like 5 GB)
I really hope you get it and maybe you can change it,

Rune
chocolatepie33
Support Team
Support Team
Posts: 2458
Joined: April 27th, 2010, 5:31 pm
IRC Username: CP

Re: On Exit Save!

Post by chocolatepie33 »

It's great, Leo. I was somewhat surprised, though, on how it just ended. Like when a program doesn't respond and it lags, then just quits, you know? But it's great.
Julius wrote:Contribute to http://www.opengameart.org NOW!
Save the wiki!
User avatar
GR1M
Support Team
Support Team
Posts: 1305
Joined: August 22nd, 2009, 4:35 pm
Name: Luke
IRC Username: Gr1m
Location: Texas
Contact:

Re: On Exit Save!

Post by GR1M »

Tear in my eye :') "Don't worry it's a happy tear".
Image
Want a user bar like this one? PM Leo
User avatar
Leo_V117
Support Team
Support Team
Posts: 1640
Joined: February 16th, 2010, 8:00 pm
Name: Leo
IRC Username: Leo_V117
Location: That one place...
Contact:

Re: On Exit Save!

Post by Leo_V117 »

The "Lag" as you say is set to allow the map to save before the program quits. I tested it on a whole map, one that I didnt save since starting it... and it saved the entire thing before closing. So yeah... The "Lag" Is intentional. and as you said Runescapedj:
srry, I haven't tested it yet, but can you make it so that it asks for overwriting (like when changing maps and forgot to save on another name before you quit, I can't see it in your code) and maybe you can make it automaticly overwrite when you save the same map as before, just only ask if you load a map or create a new map, so we don't have 2 much MB's of maps that're saved 2 much (I had a map with like 1000 saves, didn't overwrite, like 5 GB)
I really hope you get it and maybe you can change it,
I can make it ask you whether you want to save it as what you set before it saves. just to prevent overwriting the map... although the large memory consumed isnt down to me... all you need to do is delete the *.BAK files. or even add them to a "Backup" folder in "packages/base/*new folder*".

But either way... Glad you like it.
User avatar
Runescapedj
Member
Member
Posts: 1706
Joined: January 9th, 2010, 9:06 am
Name: Michiel
IRC Username: Sandboxdj
Location: Deventer, the Netherlands

Re: On Exit Save!

Post by Runescapedj »

Yeah, maybe I should ask Mike, should I? (for 2.6)
User avatar
Leo_V117
Support Team
Support Team
Posts: 1640
Joined: February 16th, 2010, 8:00 pm
Name: Leo
IRC Username: Leo_V117
Location: That one place...
Contact:

Re: On Exit Save!

Post by Leo_V117 »

In addition to what RunescapeDJ said earlier...

Add this to the bottom of the "menus.cfg" in "data/lang/en":

Code: Select all

newgui Quit [
	guitext "Quit and Save Map with Current Settings?"
	guibutton (format "Save current map as %1" $mapactionname) [echo "Saving!"; savemap $mapactionname; sleep 4000 [echo "Saved!"]; sleep 5000 [quit]]	yes
	guibutton "No"	[showgui Save_Map]	exit
	guibar
	guibutton "Close"	[cleargui]	action
	]
]

newgui Save_Map [
	guitext "Save Map"
	guifield mapactionname -20
	guibar
	guibutton "Done!"	[showgui Quit]	action
	]
]
then replace this line:

Code: Select all

                guibutton "Quit"   [savemap $mapactionname; echo "Saving!"; sleep 4000 [echo "Saved!"]; sleep 5000 [quit]]   exit
With This:

Code: Select all

				guibutton "Quit"	[showgui Quit]	exit
Save it and test it.

Tell me what you think Now.
arcones
Support Team
Support Team
Posts: 2734
Joined: January 13th, 2010, 12:42 pm
Name: Timothy
IRC Username: I use Steam
Location: Looking over your shoulder...
Contact:

Re: On Exit Save!

Post by arcones »

I'll hopefully be trying out the first one today Leo! Tell ya what I think!
Image
Want a user bar like this one? PM Leo!
Locked