Ukagaka SHIORI subsystem 'SanaJK'
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
test
.gitignore
.npmrc
.nycrc
.travis.yml
Readme.md
appveyor.yml
package.json
tsconfig.json
tslint.json

Readme.md

SanaJK

npm npm license npm download total npm download by month npm type definitions

Dependency Status devDependency Status Travis Build Status AppVeyor Build Status Code Climate Greenkeeper badge

Ukagaka SHIORI subsystem 'SanaJK'

see also create-sanajk-ghost

Install

npm:

npm install sanajk

Usage

import * as SanaJK from "sanajk";

const r = String.raw;
const myState = {
    bar: "bar",
    day: 0, // Sunday
};

const builder = new SanaJK.SanaShioriBuilder().use({state: myState}).useDefaults();

const events = builder.state.events;
events.OnBoot = () => r`\0\s[0]Boot!\e`;
events.OnMyEvent = (ctx) => r`\0\s[0]foo ${ctx.state.bar} baz\e`;

const { auto, autow, chain } = SanaJK;
const autoTalks = builder.state.autoTalks;
autoTalks.add(
    r`\0\s[0]random talk!\e`,
    auto(["tag1"], r`\0\s[0]tagged random talk!\e`),
    autow(
        5,
        r`\0\s[0]weight grouped random talk!\e`,
        r`\0\s[0]one more!\e`,
    ),
    autow(
        (ctx) => new Date().getDay() === ctx.state.day ? 1 : 0,
        (ctx) => r`\0\s[0]Today is day=${ctx.state.day}!\e`,
    ),
    chain(
        r`\0\s[0]chain talk!\e`,
        auto(
            chain(
                r`\0\s[0]nested chain talk 1!\e`,
                r`\0\s[0]one more!\e`,
            ),
            chain(
                r`\0\s[0]nested chain talk 2!\e`,
                r`\0\s[0]one more!\e`,
            ),
        ),
        r`\0\s[0]done!\e`,
    ),
);

export = builder.build();
shiolinkjs ./shiori.js

API

https://narazaka.github.io/sanajk/

License

This is released under Zlib License.