ClearScreen oddness

Greetings fellow Quest users!

I'm currently experienceing issues with a command i deemed stupidly simple before: ClearScreen.

I'm working in gamebook mode (and slowly starting to regret it), and i'm having two distinct issues with ClearScreen acting wierd.

First, adding ClearScreen to the script part of a page doesn't cause it to clear the page it belongs to. I assume this is a timing issue, with the actual page being outputted after the script run through. This is annoying nonetheless, especially since i haven't found a way to circumvent this that doesn't require input. (For example on ready {} won't work.)

Second, and much more troubling: I can't add any links to pages that have been cleared. I can output messages that use {page:} but that's it. I can't explain why this is happening, especially since it doesn't throws up any errors, either.

Any help is highly appreciated, and thanks in advance.

Example Game: (Sorry, i couldn't figure out how to put code inside a spoiler.)

<asl version="580">
  <include ref="GamebookCore.aslx" />
  <game name="Example Game">
    <roomenter type="script">
    <setcustomwidth type="boolean">false</setcustomwidth>
    <clearlastpage />
  <object name="Page0">
    <description><![CDATA[This is the starting page.<br/><br/>{page:Page1}]]></description>
    <script type="script">
    <object name="player">
      <inherit name="defaultplayer" />
  <object name="Page1">
    <inherit name="scripttext" />
    <description><![CDATA[This shouldn't be visible.<br/><br/>{page:Page2}]]></description>
    <options type="stringdictionary" />
    <script type="script">
      msg ("Screen cleared!")
      wait {
        msg ("Screen cleared... again.")
        AddPageLink (this, Page2, "Page2")
        wait {
          AddPageLink (this, Page2, "Page2")
          wait {
            msg ("{page:Page2}")
  <object name="Page2">
    <description>Whee, you finished the game!</description>
    <script type="script">

Actually, it's working as planned. The script is executed before text output. It deletes the screen and prints text, then the script waits. Meanwhile, the normal page text is printed. With 'return' the script continues. AddPageLink tries to add the link to the normal page text, but the page text has already been printed before. Therefore the link is not visible. With msg("{page:Page2}") an explicit output is made, which can then be seen.

I see. Although i don't get why AddPageLink behaves like that, isn't it unnecessarily convoluted?

And, as far as i can see, there is no simple way to make a script execute after the page text is printed, but before the player gets to do something? I mean, this would be very handy with a couple of scripts and functions, mostly MovePlayer, etc.

You could edit and extend the core function DoPage


I think getting this whole thing over into a "proper" textadventure will be easier, and probably safe me from a great deal of aneurysms, even if it means rewritting everything from scratch.

More on topic - i do not consider myself skilled enough to tinker around with CoreFunctions or CoreLibraries without advice. If there were any code samples i could use - sure, but not on my own.

No Problem: choose 'Filter' in the left lower corner of Quest (offline version) and activate 'Show Library Elements'. You will find now lots of new functions in the Functions section. Select 'DoPage' and press the copy button. Now you can edit this function in your game. There you will find the existing script call

      if (GetBoolean(player.parent, "runscript") or GetBoolean(player.parent, "runscriptonly")) {
        if (HasScript(player.parent, "script")) {
          do (player.parent, "script")

At the end of this 'on ready' block you can add something like

      if (GetBoolean(player.parent, "runscript") or GetBoolean(player.parent, "runscriptonly")) {
        if (HasScript(player.parent, "scriptlast")) {
          do (player.parent, "scriptlast")

And you must add a new script to your page (in code view, you can't edit it in the visual editor!)

    <scriptlast type="script">
      msg("script is executed")

mission accomplished!

Or if you only want to do it for a couple of pages, the page's script could look something like:

msg ("This script will run *before* the page's text is displayed")

this.runscript = false
this.runscriptonly = false
DoPage (this)
this.runscriptonly = true

msg ("This script will run *after* the page's text and options")

That changes the page's type to "text", displays it, and then changes the type to "script" (so the text isn't displayed again afterwards)


Thanks an unfathomably lot!

I didn't knew you could do such a thing without editing libraries (documentation for Quest, especially Gamebook mode, seems to be lacking), but this is exactly what i need. The gap where the page format is changed is annoying, but i can deal with that.

Once again, i'm deeply grateful.

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