nsensfel / tonkadur

Narrative scripting/programming tool. Write stories in your favorite editor using a feature-rich language, compile them into a very small and simple language to easily integrate them into your game.
https://tonkadur.of.tacticians.online
Apache License 2.0
2 stars 0 forks source link

Wyrd player choices should use the Program Counter #3

Closed nsensfel closed 4 years ago

nsensfel commented 4 years ago

Currently, Wyrd handles player choices by providing the interpreter with a rich text computation and a sequence of instructions for each player choice. This is needlessly complicated for the interpreter to handle, and is the only case of a set of instructions being passed as parameters (which is not supposed to be supported in Wyrd anyway).

Instead, the code should contain all these sequences of instructions, prefixed by a SetPC to jump over them, and affixed with a SetPC to go just after the next ResolveChoices instruction if the sequence is executed. Using this, the AddChoice instruction should only have for parameters a rich text computation and an integer corresponding to the line starting their sequence. The interpreter can then simply react to ResolveChoices instructions by setting the Program Counter.

nsensfel commented 4 years ago

Done.