How do I make the game title & author stuff display again on a "resume" of a saved game?

This is simple, I know. I just want to display the game title, subtitle, and author again for the player after resuming a saved game. I dislike how it begins with a blank screen and the command bar up top. (It would be nice for it also to show what room they're in and the room descrip, too, as a reminder.)

I know I have seen this somewhere on the Quest documentation or forums -- how you are supposed to include some kind of code for stuff you want to display on subsequent saved games -- but I just can't find it.

I know it has to do with the User Interface Initialisation Script under Advanced Scripts on the desktop editor, but I don't know how to put the info already entered in the Setup tab (game name, subtitle, author) as code within the Advanced tab's box for the initialisation stuff. I am not savvy with JS, by the way...


The "UI Initialisation script" runs when the game first starts, and again when a saved game is loaded. So if you want to use it to display the title and author information, you will probably want to check if the game has already started.

The easiest way to do that is probably something like:

firsttime {
}
otherwise {
  // put your code here
}

Alternatively, you could turn off automatically showing the title at the start of the game, and rely on the UI Initialisation script to do it both times.

As far as displaying the title goes, the code Quest uses at the start of the game is:

      JS.StartOutputSection ("title")
      PrintCentered ("<span style=\"font-size:260%\">" + game.gamename + "</span>")
      if (game.subtitle <> null) {
        if (LengthOf(game.subtitle) > 0) {
          PrintCentered ("<span style=\"font-size:130%\">" + game.subtitle + "</span>")
        }
      }
      if (game.author <> null) {
        if (LengthOf(game.author) > 0) {
          PrintCentered ("<br/><span style=\"font-size:140%\">[By] " + game.author + "</span>")
        }
      }
      msg ("<div style=\"margin-top:20px\"></div>")
      JS.EndOutputSection ("title")

I dislike how it begins with a blank screen and the command bar up top.

It's supposed to start a saved game with everything that was previously on screen. There was a bug which failed to save this information (I think it worked if you clicked the 'save' button but not using the save command, or maybe vice versa), but I thought that had been fixed. Are you using an old version of Quest, or have you got it clearing the screen after each turn?

In any case, to show the room description you would just want to add the line:

ShowRoomDescription

Thanks! This looks perfect.

I have been using Quest 5.8, and typing in the command "save" does the blank command bar up top if you are playing online. I'm not clearing the screen after each turn.


So I tried this by pasting it into the textbox under UI Initialisation Script, in the Advanced Scripts tab for the Game. Trying a "save" command from desktop play, I just get the last screen displayed before the save.

}
otherwise {
  JS.StartOutputSection ("title")
  PrintCentered ("<span style=\"font-size:260%\">" + game.gamename + "</span>")
  if (game.subtitle <> null) {
    if (LengthOf(game.subtitle) > 0) {
      PrintCentered ("<span style=\"font-size:130%\">" + game.subtitle + "</span>")
    }
  }
  if (game.author <> null) {
    if (LengthOf(game.author) > 0) {
      PrintCentered ("<br/><span style=\"font-size:140%\">[By] " + game.author + "</span>")
    }
  }
  msg ("<div style=\"margin-top:20px\"></div>")
  JS.EndOutputSection ("title")
  ShowRoomDescription
}```

Sorry -- the paste did not pick up the first 2 lines, even though I see they were highlighted from when I copied!!!

}```

Yes, they are there in my game with the rest of that code.  I thought it would show the title and just the current location on a resume of the game.  I'm trying this out on desktop before I put it online.

Evidently, I don't know how to do the backticks, so it isn't showing (again) the first 2 lines of the code --

firsttime {
}


Hmm… that should work. I'm wondering if the UI initialisation is running before the restore script that reloads the previously-saved output log; in which case the output log would replace the new title.


I guess my main concern is that when playing online, all you see on a resume is the blank command bar up top. (When playing on desktop, you do indeed see the contents of the screen prior to the "save" command.)

If I could fix that, I'd be happier.


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

Support

Forums