npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

spellcast

v0.50.0

Published

Make: your own adventure!

Downloads

64

Readme

Spellcast Logo

Spellcast is a scripting language, an interpreter/server, plus a terminal and a web clients with powerful capabilities.

It's main purpose is to create scenario with branches, so you can build game in the spirit of old roleplay gamebooks out of the box.

But Spellcast can also be embedded into your app, to allow users to create content, item, campaign and so on.

This page focus on the story capabilities of spellcast, but Spellcast is also a task-runner.

See also:

Usage

Usage: spellcast story [<book>] [<options 1>] [<options 2>] [...]

Options:

  • --ui <name>: Set the UI to use
  • --locale <locale>: Set the locale for the script
  • --locale-list: List the available locales
  • --assets <URL>: Set the asset base URL (default: main book directory)
  • --ws-server [<port>]: Create a web socket server (default to port 57311)
  • --http: Create a HTTP server for content, sharing the port of the web socket server
  • --token <token>: Add a token to server accepted token list (can be used multiple times)
  • --browser , -B <exe>: Open a client browser , force --ws-server and --http
  • --electron , -E: Open Electron client, force --ws-server and --http
  • --client-ui <name>: Set the UI for the local client (use with --browser)
  • --client-name <name>: Set the name of the local client user
  • --script-debug: Activate debug-level logs for scripts ([debug] tag)
  • --script-verbose: Activate verbose-level logs for scripts ([debug verbose] tag)
  • --max-ticks: Max ticks between two user interactions (prevent from infinite loop, default: Infinity)
  • --js/--no-js: Turn on/off the [js] tags

Getting started: basic script example

This is an example of a very short script with 3 scenes, featuring the most basic tags. Copy-paste this script into a file named test.kfg, then run spellcast story test.kfg.

[[doctype spellcast/book]]

[chapter intro]
	[scene village]
		[message]
			$> You lived in a small village of few hundred peoples.
			$> You started learning how to forge horseshoe since the age of 12
			$> with your father, the local smith.
			$> At the age of 15, you leave your village.
			$> What do you do?

		[next master]
			[label] $> You seek for a master at forgery.
			
		[next rogue]
			[label] $> You are a rogue living in the wood.

	[scene master]
		[message]
			$> You found the master and learn everything he taught to you.
			$> You became famous in the entire country.
		
		[win]

	[scene rogue]
		[message]
			$> You lived in the forest and becomes an highwayman.
			$> That's really bad!
		
		[lost]

In this example, the story in the first message tag is displayed to the player. Then the player has 2 choices:

  • either he seeks for a master at forgery, and it will trigger the scene named master, therefore winning the game by becoming famous
  • either he becames a rogue (triggering the rogue scene) and lost by becoming an highwayman

The syntax of Spellcast books is really simple. The main component of Spellcast is tag. A tag start with an opening bracket and finish with a closing bracket. The content of a tag is indented using tabs.

So here we have:

  • The [[doctype spellcast/book]] is a meta-tag, it tell spellcast that the current file is a spellcast story file. Meta-tags have two opening and two closing brackets, they MUST be placed before any other tags, because they are headers.
  • A top-level container tag: the [chapter] tag with an identifier (intro).
  • This chapter contains 3 [scene] tags named village, master and rogue.
  • The first scene contains 2 [next] tags: those tags tell which scene will follow the current one.
  • When there are more than one [next] tag in a scene, the player can choose between multiple choice.
  • The [next] tag has a scene identifier, e.g. [next master] means that if the player choose that option, the next scene will be the one named master.
  • The [label] tag is simply the text displayed to the user for this choice.
  • The [message] tag contains text to be displayed to user.
  • The [win] and [lost] tags causes the game to exit, either with a game win or a game lost.
  • all text supports internationalization and localization