Pre-release
AdventureJS Docs Downloads
Score: 0 Moves: 0
// printWithInput.js

(function () {
  /*global adventurejs A*/

  var p = adventurejs.Display.prototype;

  /**
   * Print a message preceded by player's input back to game display.
   * @memberOf adventurejs.Display
   * @method adventurejs.Display#printWithInput
   * @param {String} msg An arbitrary string.
   * @param {String} classes Optional class(es) to apply to output.
   */
  p.printWithInput = function Display_printWithInput(msg, classes) {
    if (this.game.parser.getInputCount() > 0) {
      this.print("> " + this.game.parser.getLastInput(), "input");
    }
    this.print(msg, classes);
  };
})();