Skip to content

Exit expression

Latest
Compare
Choose a tag to compare
@siriuslatte siriuslatte released this 21 Mar 02:29
· 24 commits to main since this release
e7ccd51

Added an exit expression, used to close the current running Scribe's thread. You can listen for this change of your Scribe program's state within the onExit callback.

import { Scribe } from "@aethergames/scribe";

const ScribeRuntime = Scribe.load(
    `
    exit "Hello, world!"
`,
    {/** Your environment */},
);

ScribeRuntime.onExit = ({ output }) => print(output); // Hello, world!

ScribeRuntime.start();

Also some minor fixes with dialogs execution yielding the current thread, therefore leading to multiple bugs (scenes not being started, objectives not being changed, declarations after the dialog were ignored which also led to a bunch of warnings), those are fixed now.

import { Scribe } from "@aethergames/scribe";

const Beatriz_Id = "BEATRIZ_ID";
const ScribeRuntime = Scribe.load(
	`
    actor BEATRIZ $beatriz_id

    [BEATRIZ] "Interaction will still be declared without a problem." with {
        option "This is an option." {
            ...
        }
    }

    interact BEATRIZ {
        echo "Hello, I've been declared!"
    }

`,
    {
        beatriz_id: Beatriz_Id,
    },
);

ScribeRuntime.start();
ScribeRuntime.interact(Beatriz_Id);

Now there's no errors.

The decision behind not increment 0.Y.0 it's because this wasn't such a big change, nor a big addition to the language but rather something that was left behind as the language went on.

What's Changed

  • fix(dialogs) & meta(versioning): yielding removed, fixed a lot of issues by @siriuslatte in #3
  • feat(visitor): add exit expression by @siriuslatte in #4
  • feat(tests) & meta(npm): add npm-run-all & unit tests by @siriuslatte in #5

Full Changelog: v0.2.1-beta.1...v0.2.2-beta.1