On Exit Save!
Posted: June 6th, 2010, 3:51 pm
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:
Directly below this part: add this: 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.
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
]
Code: Select all
guibutton "Texture Menu (F2)" "showtexgui"
Code: Select all
guibutton "Quit" [savemap $mapactionname; echo "Saving!"; sleep 4000 [echo "Saved!"]; sleep 5000 [quit]] exit
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.