Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including tbq with all npm packages installed. Try it out:

var tbq = require("tbq")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

tbq v0.2.0

Text Based Quest games engine for node

TBQ: Text Based Quest games engine

Build Status Dependency Status

Create a data file (e.g. data.json), you can find format explanations in corresponding file. Then use the engine:

const TBQ = require('tbq');
const game = TBQ.createGame(require('data.json'));

do {
  var playerInput = /* Somehow get player input */
  var actionResult = game.exec(playerInput);
  /* Output actionResult.text to player */
} while (!actionResult.end)

Each game.exec(playerInput) call returns { text, end } object (text property is null if command is invalid in given circumstances).

License

MIT

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free