autosave.cfg 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. // old autosave system (superseded by autosaved xmaps)
  2. // (write "load_autosave" into your autoexec.cfg to load)
  3. persistidents 0 // don't save default values
  4. checkinit mapstartalways [numAutoSaves = 0; autoSaveCheck]
  5. checkinit onNewMap [numAutoSaves = 0; autoSaveCheck]
  6. alias autosavemap 0 // Autosavemap system disabled by default
  7. alias timeBetAutoSaves 300000 // Autosave once every 5 minutes.
  8. alias numAutoSaveBackups 3 // Make a map .bak every 3 autosaves (15 minutes) by default
  9. tempalias numAutoSaves 0
  10. const autoSaveCheck [ if $autosavemap [ sleep $timeBetAutoSaves doAutoSave ] ]
  11. const execAutoSave [
  12. += numAutoSaves 1
  13. push oldmapbackups $mapbackupsonsave
  14. if (|| (!= $numAutoSaveBackups $numAutoSaves) (= $numAutoSaveBackups 0)) [ mapbackupsonsave 0 ] [ numAutoSaves = 0 ] // Temporarily turn off map backups to avoid clutter.
  15. savemap (curmap)
  16. mapbackupsonsave (pop oldmapbackups)
  17. echo "\f1The map was automatically saved. \f5Next auto-save in" (divf $timeBetAutoSaves 60000) minutes.
  18. ]
  19. const doAutoSave [
  20. if $autosavemap [
  21. if (&& (! (strstr $__defaultmaps (curmap))) (strlen (curmap))) [
  22. if $editing execAutoSave [
  23. if (= $gamemode (modenum coop)) execAutoSave
  24. ]
  25. ]
  26. ]
  27. autoSaveCheck
  28. ]
  29. showedBAKinfo = 0
  30. // amend settings menu
  31. newmenu [Editing settings]
  32. menuitemcheckbox "Enable auto save map: " "$autosavemap" [ autosavemap = $arg1 ]
  33. menuitemslider "Time between auto saves (in minutes): " 2 60 "(div $timeBetAutoSaves 60000)" 1 [ timeBetAutoSaves = (* $arg1 60000) ]
  34. menuitemtextinput "Make a map backup (.BAK) every: " "$numAutoSaveBackups" [ numAutoSaveBackups = $arg1 ] [ if (! $showedBAKinfo) [ echo This setting effects the number of autosavemaps between making a map backup file. "(.BAK)"; showedBAKinfo = 1 ] ] 4