mwg API
    Preparing search index...

    Function importTwee

    • Reads a .twee file into an EventStoryScript.

      The actual parsing (passages, [[links]], StoryData/StoryTitle) lives once in core.parseTwee - this is a thin wrapper naming the rpg-specific return type, the same way two-d/stage.importTwee wraps the same engine for StageCommand.

      Parameters

      • source: string

      Returns EventTwineStory

      import { importTwee, EventRunner, GameState, type DialoguePresenter } from '@datamoc/mwg/rpg';

      declare const present: DialoguePresenter;

      const story = importTwee(`:: Start
      You stand at a crossroads.

      [[Take the left path->Left]]
      [[Take the right path->Right]]

      :: Left
      The path ends at a wall.

      :: Right
      An open road.
      `);
      const runner = new EventRunner({ present, game: new GameState() });
      await runner.runStory(story.story, story.start);