MZ - Visustella Autosave not considered "last"

● ARCHIVED · READ-ONLY
Started by Indinera 10 posts View original ↗
  1. As mentioned in the title I'm using Visustella Savecore and their autosave.
    It works fine except for one thing: when loading a savefile, it's generally the last saved that is automatically picked, except autosave is never considered. I don't think it's very natural or convenient and would like to know if there is any way around it?
    Thanks in advance for any suggestion.
  2. Could you provide some screenshots. I have a few follow up questions but I want to make sure I'm not making any assumptions about your view
  3. I'm on phone right now but what do you want a screenshot of?
  4. Was out sorry.

    The title screen and then what you see when you click Load Game
  5. The title screen shows pretty much the usual menu.

    1733761974892.png


    Then when clicking on continue it's just something pretty usual as well.

    1733762003335.png

    But instead of picking directly file 6 with the timer at 6:29:35, I'd like it to pick the autosave if the timer is more advanced, eg:

    1733762050834.png
  6. That's core behaviour, so if VisuStella doesn't have a parameter for that, a plugin written for the core scripts might help. E.g. (untested):
    plugin code
    JavaScript:
    /*:
     * @target MZ
     * @plugindesc Allows auto-select of autosave slot on Scene_Load.
     * @author Caethyril
     * @url https://forums.rpgmakerweb.com/threads/173786/
     * @help Free to use and/or modify for any project, no credit required.
     */
    // Patch - also check timestamp of autosave.
    ;void (alias => {
      Scene_Load.prototype.firstSavefileId = function() {
        const r = alias.apply(this, arguments);
        if (this.needsAutosave() && r < DataManager._globalInfo[0]?.timestamp)
          return 0;
        return r;
      };
    })(Scene_Load.prototype.firstSavefileId);
    (Design note: DataManager.latestSavefileId deliberately excludes autosave and the core scripts only use it for this auto-select thing. I don't know why it was coded that way, though, so I preferred to patch the load scene instead.)
  7. It looks like it works. Thank you very much.
  8. OK, so it turns out it didn't work correctly...because I was comparing the usually-selected save file ID against the autosave timestamp. Should be timestamp vs timestamp: obvious in hindsight. :kaoslp:

    Try this instead~
    plugin code v2
    JavaScript:
    /*:
     * @target MZ
     * @plugindesc v2 - allows auto-select of autosave slot on Scene_Load.
     * @author Caethyril
     * @url https://forums.rpgmakerweb.com/threads/173786/
     * @help Free to use and/or modify for any project, no credit required.
     */
    // Patch - also check timestamp of autosave.
    ;void (alias => {
      Scene_Load.prototype.firstSavefileId = function() {
        const r = alias.apply(this, arguments);
        if (this.needsAutosave()) {
          // Get & compare timestamps for usual & auto save files.
          const t = DataManager.savefileInfo(r)?.timestamp;
          const a = DataManager.savefileInfo(0)?.timestamp;
          if (t < a)
            return 0;
        }
        return r;
      };
    })(Scene_Load.prototype.firstSavefileId);
    I did a quick test and it seemed OK, but let me know if you have any more problems with it~ :kaohi:
  9. It looks like it did work this time, thank you.
  10. Great, you're welcome! :kaojoy: