Skip to content

Instantly share code, notes, and snippets.

@videlais

videlais/preTwee3.md Secret

Created Jun 8, 2019
Embed
What would you like to do?

Notation

The notation is written as a series of three parts for the header of each passage:

  • Sigil: Two colons (":") followed by a single space
  • Passage Name: The name of the passage followed by a single space. Passage Names can contain spaces, alphanumeric characters, and punctuation. Meta-characters such as curly braces or square brackets should be avoided.
  • Tags: One or more tags separated by a single space each within square brackets
  • Coordinates: Currently exclusive to Twee2, coordinates can be given in the following format: <123,456>

The content of a passage continues until the next sigil of a passage is found or the input ends with at least a single empty line between passage headers.

Example Twee Notation:

:: Snoopy [dog peanuts]
Snoopy is a dog in the comic Peanuts.

:: Charlie Brown [person peanuts]
Charlie Brown is a person in the comic Peanuts

Special Passage Names

Many compilers understand and process certain case-sensitive keywords differently. The following is a common set of reserved passage names.

Start

The first passage.

Example:

:: Start
A beginning!

StoryTitle

The title of the story.

Example:

:: StoryTitle
A Named Story

StorySubtitle

Twine 1.4.2:

The subtitle of the story.

Twee2:

Ignored during HTML compilation process.

Example:

:: ```StorySubtitle```
The subtitle of this story

StoryAuthor

Twine 1.4.2:

The author of the story.

Twee2:

Ignored during HTML compilation process.

Example:

:: ```StoryAuthor```
John Smith

StoryMenu

Twine 1.4.2:

Corresponds to the menu that hovers in the upper-right corner of the page in the Jonah story format, or on the left side of the page in the Sugarcane story format.

Twee2:

Ignored during HTML compilation process.

Example:

:: StoryMenu
Content of the story menu!

StorySettings

Used to specify certain options and settings depending on the compiler used.

Twee2:

Ignored during HTML compilation process.

Optional Tweego Settings:

  • ifid: the story's IFID (Interactive Fiction IDentifier)

Optional Twine 1.4.2 Settings:

  • undo: enables the player to "undo moves." In Sugarcane, this means being able to use the Back button in the browser. In Jonah, this means being able to use the “Rewind to here” link, and being able to click links in previous passages.

  • bookmark: enables the player to use the “Bookmark” link in Sugarcane and Jonah. On by default.

  • hash: this causes the current passage's bookmark URL to be automatically placed in the player's browser address bar whenever they change passages. This is off by default because the URLs can become very long and ugly quickly.

  • exitprompt: If the player tries to reload or close the page, the browser will prompt for confirmation. This is useful for long games - it would be unfortunate if the player lost a lot of progress due to an idle key-press.

  • blankcss: This removes most of the CSS used by the story format, allowing CSS programmers to write their own stylesheet redesigns more easily. Off by default - but including the text “blank stylesheet” in a stylesheet will set it on automatically.

  • obfuscate: obfuscates the story's HTML source using ROT 13 to dissuade people from spoiling themselves by reading it. Off by default.

  • jquery: if the jQuery library should be included or not

  • modernizr: if the Modernizr should be included or not

Example:

:: StorySettings
undo:on
bookmark:on
hash:on
exitprompt:on
blankcss:on
obfuscate:rot13
jquery:on
modernizr:on

StoryIncludes

A list of any local or remote files to combine with the story during the HTML compilation process.

Tweego:

This passage is ignored, as Tweego will bundle any JavaScript source files automatically as it detects them.

Twee2:

Other Twee2 compiled files (.tw2) can be used.

Twine 1.4.2:

Both Twine Story (.tws) and Twine Source (.twee) files can be used.

Example:

:: StoryIncludes
localfile.tws

::@include

Twee2:

Include the contents of another file at that point in the code. Does not work recursively.

Example:

::Garden [haml]
%p
  The garden winds around decorative trees.
%p
  ::@include description-of-house.tw2

Special Tag Names

Passage headers can contain any collection of tags. Two of the most common are stylesheet and script, but some Twee compilers such as Tweego and Twee2 also recognize and use others.

stylesheet

Any additional or overriding CSS rules for the story.

Twine 2"

This is the equivalent of Story Stylesheet and is often translated as UserStylesheet[stylesheet].

Tweego:

Unnecessary. Tweego automatically incorporates all CSS (.css) files it finds.

Example:

:: UserStylesheet[stylesheet]

script

Any additional or overriding JavaScript code for the story.

Twine2:

This is the equivalent of Story JavaScript and is often translated as UserScript[script].

Tweego:

Unnecessary. Tweego automatically incorporates all JavaScript (.js) files it finds.

Example:

:: UserScript[script]

scss stylesheet

Twee2

Any additional or overriding CSS rules written in SASS.

Example:

::MyCoolStylesheet [scss stylesheet]

body {
  background: #eee;
}

tw-passage {
  tw-link {
    color: red;
  }
}

coffee script

Twee 2

Any additional or overriding CoffeeScript for the story.

Example:

::SomeAwesomeCode [coffee script]

alert 'This message will appear when the adventure starts!'

haml

Twee 2

Any additional HAML code.

Example:

::NicksBar [haml]
%p
  Nick's Bar is exactly the kind of nightspot that helps you remember why you quit drinking.
%p
  %strong What would you like to do?
%ul
  %li [Nick<-Talk to the bartender]
  %li [BarToilet<-Go to the bathroom]

twee2

Twee 2

Additional configuration options or Ruby code to run during the HTML compilation process.

Example:

::Configuration [twee2]
Twee2::build_config.story_ifid = '41AB7776-D198-40F5-BD54-0493D49DA58C'
Twee2::build_config.story_format = 'Snowman'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.