Output effects (including pausing) - ThePix/QuestJS GitHub Wiki

These are related as the text flow stops and waits for the player to click something before continuing.

Adding a blank line

There are different ways to do this, but the simplest is to use the blankLine function.

blankLine()

Adding a horizontal rule

The simplest way to add a horizontal line is to use the hr function.

hr()

Clearing the screen

The function clearScreen clears the screen.

clearScreen()

Pausing output

If you have a lot of text to display, or you just want to add a dramatic pause, you can use the wait function.

settings.setup = function() {
  msg("{i:The \"Star Pixie\" left Earth orbit in 2843, on a centuries-long mission to boldly go, etc.}");
  wait()
  msg(" ");
  msg("'Good morning,' says a female voice. ...");
  wait()
  msg(" ");
  msg("'Okay...'");
};

Note that unlike Quest 5, subsequent wait calls do need to be nested.

The wait function can be given a number, in which case it will wait for that many second before continuing, rather than require the player to click a button.

The trigger function

If you want something to happen after a pause, use the trigger function. This should be given a function parameter; the function will fire when the output gets to this point. In the example low, the function will be triggered by the player clicking for the wait1 function.

  msg("'So these are all the facts I have. ...'")
  wait()
  blankLine()
  trigger(function() {
    settings.setUpDialog()
    return true
  })

The io.showInTab function

The function can be used to create a new tab in the browser. It should be given a string of HTML which will get inserted into the BODY element of the new tab. You can give a second attribute; this will be used as the page title.

Be aware that some browsers block new tabs; in that event the user will see a message advising her of that. The user may be able to take action to allow it, and could then repeat the command.

This is used by the transcript system; whether it is useful for anything else I am not sure.