ink icon indicating copy to clipboard operation
ink copied to clipboard

[Proposal] Dynamic Diverts

Open SirMetathyst opened this issue 4 years ago • 0 comments

This is a follow up to #668 but in a more proposal/proposal-like format.

Main.ink

Once upon a time...

 * I ran across the street.
 * I took a bus to boston.

- They lived happily ever after. -> external_chapter.Main

This gives the following error in inky: "Divert target not found: '-> external_chapter.Main'

What if we introduced the ability to compile this ink to json when external_chapter.Main is $external_chapter.Main where '$' denotes a dynamically loaded ink file by name/key.

In the Inky editor when we want an ink file to be dynamically loaded through a resolver at runtime and not included in the Main.ink file we can prepend the '$' symbol which would tell the compiler to compile this ink file separately as an appendable chunk/plugin.

When the ink runtime reaches a divert target where the first character begins with '$' this tells the runtime to dynamically load the ink file (up to the dot) and append it to the current story through a resolver function specified by the developer if the knot-stitch after does not exist.

SirMetathyst avatar Jun 02 '21 17:06 SirMetathyst