Extending the framework

Sometime you just need more.

Introduction

VeinIF provides the foundation to easily create choice-based Interactive Fiction games, but for specific features . In the case where creators wants

Can't find an example of what you're looking for? Please create a new issues on our GitHub page and describe your request.

Example 1: Adding new property to the "Paragraphs" interface

Use case: suppose the programmer wants to add optional property "special" that will trigger a custom function.

First, create a new interface that extends the Paragraphs interface. The new interface will inherit all of Paragraphs 's property plus the addition of the special property.

interface ParagraphPlus extends Paragraphs {
  special?: string;
}

export function getParagraph(player?: Player) {
  let paragraphs: ParagraphPlus[] = [ ... ]

Next, navigate to src/core/paragraphsFunction.ts. In updateParagraph(), add the necessary function to handle your new property.

Last updated

Was this helpful?