rpg-dialog
the rpg dialog system for terminal
Installation
npm install rpg-dialog
Quickstart
const rpg = require("rpg-dialog");
rpg({
dialog: "welcome to rpg-dialog",
sound:"default",
speed: 1000
}).then(function(){
// do stuff
console.log("success");
});
Format
Callback:
var options = {
dialog: "some dialog",
sound: "default",
speed: 1000
};
rpg(options,function(){
console.log("it's all done");
});
Promise:
var options = {
dialog: "some dialog",
sound: "default",
speed: 1000
};
rpg(options)
.then(()=>{console.log("promise example")})
.then(()=>{console.log("another task")});
Options
var options = {
// expects string, or an array of strings
dialog: "a string" || ["this","is", "an", "array"],
// expects a keyword string(see below), or a sound object
sound: {
// expects string path to a file.
files: "./path/to/yourfile.wav",
// expects bool, false will disable sound.
enable: true
},
// expects int, in ms.
speed: 1000
}
Sound keywords:
default
- plays the default "blip" sound,
bottles
- plays bottles the mole's voice back,
mumbo
- plays mumbo jumbos voice back
Example:
var options = {
dialog: "Hi, my name is Bottles",
sound: "bottles",
speed: 2500
};
rpg(options)
.then(()=>{console.log("complete")});