4.0.0 • Published 3 months ago

@clyde-lang/interpreter v4.0.0

Weekly downloads
-
License
MIT
Repository
-
Last release
3 months ago

Clyde Interpreter

npm version

Interpreter library for Clyde dialogue language.

import { parse } from '@clyde-lang/parser';
import { Interpreter } from '@clyde-lang/interpreter';

const content = parse(`

Hagrid: Yer a wizard, Harry!
Harry: I'm a what?
    * Hagrid: A wizard, Harry!
    * Hagrid: Yer a wizard!

`);

const dialogue = Interpreter(content);

dialogue.getContent()

//respone: { type: 'line', text: 'Yer a wizard, Harry!', speaker: 'Hagrid }

dialogue.getContent()

// response:
// {
//     type: 'options',
//     name: "I'm a what?",
//     speaker: 'Harry',
//     options: [
//         { label: 'A wizard, Harry!' },
//         { label: 'Yer a wizard!' }
//     ]
// }


dialogue.choose(1)

dialogue.getContent()

// response: { type: 'line', text: 'Yer a wizard', speaker: 'Hagrid }

Instalation

npm install @clyde-lang/interpreter

# or

yarn add @clyde-lang/interpreter
4.0.0

3 months ago

3.1.0

2 years ago

3.0.2

2 years ago

3.0.1

2 years ago

3.0.0

2 years ago

2.0.1

3 years ago

2.0.0

3 years ago

1.0.0

3 years ago

0.1.3

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago