Loaded saved game in web player has nothing in #divOutput

IRRELEVANT CODE REMOVED

That's how the web player saves the data from #divOutput.

So how can we retrieve that data?

(I've tried reading the docs on ajax, but I can't figure this out at all.)

The WebPlayer doesn't load the existing in-game text when loading a saved game unless you used the Save button to save. Using the save command will result in no existing in-game text when loading a saved game.


Okay... After reading old posts and testing things:

When playing online and saving your progress:

  • if you click the Save button to save, your divOutput will be there when you load your saved game
  • if you use the SAVE command, your divOutput will NOT be there when you load your saved game

The save command in Quest 5.8.0 (which does not do anything I intended, and would be missing a call to JS.afterSave() even if game.questplatform did exist):

  <!-- Modified by KV to resolve issue with empty divOutput when saving online with this command. -->
  <command name="save">
    <pattern type="string">^save$</pattern>
    <script>
      if (HasAttribute(game, "questplatform")) {
        if (game.questplatform = "desktop") {
           request(RequestSave, "")
        }
        else {
          JS.saveGame ()
        }
      }
      else {
        request(RequestSave, "")
      }
      game.suppressturnscripts = true
    </script>
  </command>

The save button only has this happening on click:

saveGame()
afterSave()

First, I believe the save command in Quest needs to be changed back to:

  <command name="save">
    <pattern type="string">^save$</pattern>
    <script>
      request(RequestSave, "")
      game.suppressturnscripts = true
    </script>
  </command>

Second, I've done this to WebPlayer\player.js in my build of the web player:

function sendCommand(text, metadata) {
    if (_pauseMode || _waitingForSoundToFinish || _waitMode || !canSendCommand) return;
    canSendCommand = false;
    markScrollPosition();
    if (text.toLowerCase().trim() == "save") {
      //console.log("KV is bypassing the save command and emulating a Save button press!");
      saveGame();
      afterSave();
    }
    else {
      window.setTimeout(function () {
          $("#fldUITickCount").val(getTickCountAndStopTimer());
          var data = new Object();
          data["command"] = text;
          if (typeof metadata != "undefined") {
              data["metadata"] = metadata;
          }
          $("#fldUIMsg").val("command " + JSON.stringify(data));
          $("#cmdSubmit").click();
      }, 100);
    }
    afterSendCommand();
}

All the older games I can find have the Save button; so, I want to jump to conclusions and decide this will fix the issue with displaying the saved divOutput online with no possible side effects.

I've been testing old and new games (and in between games), and I haven't had any issues (yet).


This topic is now closed. Topics are closed after 14 days of inactivity.

Support

Forums