Skip to content

Instantly share code, notes, and snippets.

@IFcoltransG
IFcoltransG / parse_expression.ink
Last active September 9, 2025 22:32
A parser for very simple maths expressions in Ink
// Ink expression parsing code created by IFcoltransG
// Released into public domain
// May be used under the MIT No Attribution License
CONST string_to_parse = "5 * 10"
Parsing "{string_to_parse}"
~ temp c = "" // initial cursor
~ temp result = parse_expression(string_to_parse, c)
@IFcoltransG
IFcoltransG / strings.ink
Last active September 9, 2025 11:04
String manipulation utilities in Ink, based on my "capitalise" code
// Ink string util code created by IFcoltransG
// Released into public domain
// May be used under the MIT No Attribution License
// All functions only work on supported symbols that have been added
// to the `letters` variable below.
/*
This is a sentinel token. It should be set to something that won't appear in any words.
@joningold
joningold / gist:0a45fadb69e697ff34294a2aa8f06ce6
Last active September 1, 2025 07:58
Storylet implementation
/* "Storylet" implementation.
Based on https://github.com/smwhr/ink-storylets/tree/main by smwhr.
This allows you to create content as "storylets" - little chunks / scenes, which are gated by preconditions. The game offers a choice of which one the player can look at, by picking the top N that are available now.
The machinery is fairly light, and the data is kept "with" the story content, so its easy to use as an extendable template.
*/
LIST Fruit = Apple, Banana, Orange, Lemon
VAR fruitSaladIndex = 0
- (top)
* [add apple ]
~ addToSalad(Apple)
* [ add banana ]
~ addToSalad(Banana)
* [ add orange ]
~ addToSalad(Orange)
@IFcoltransG
IFcoltransG / capitalise2.ink
Created January 4, 2024 02:12
Word capitalisation in Inkle's Ink language (v2)
// Ink capitalisation code (v2) created by IFcoltransG
// Released into public domain
// May be used under the MIT No Attribution License
/*
This is a sentinel token. It should be set to something that won't appear in any words.
*/
CONST START = "^^"
/*
@annakrasner
annakrasner / index.html
Last active January 31, 2025 23:28
InkyDoc: a google doc formatting Apps Script for the Ink Narrative Scripting Language
<!--
Change polling sidebar based from
//https://gist.github.com/tanaikech/f27d427f07b20ca9fedec21e643c4a3e
Inkjs runtime+ compiler from https://github.com/y-lohse/inkjs/releases/tag/v2.2.2
Ink js webplayer from https://yannick-lohse.fr/inkjs/
-->
<body>
@IFcoltransG
IFcoltransG / clicker.ink
Last active January 4, 2024 01:31
Inline "clickers" in Inkle's Ink, for choices that toggle a variable
// Ink clicker code created by IFcoltransG
// Released into public domain
// May be used under the MIT No Attribution License
LIST journey_soundtrack_songs = Nascence, Apotheosis, Reclamation
VAR a = Nascence
VAR b = Apotheosis
-> go
== go
@IFcoltransG
IFcoltransG / capitalise.ink
Created August 19, 2023 11:25
Word capitalisation in Inkle's Ink language
// Ink capitalisation code created by IFcoltransG
// Released into public domain
// May be used under the MIT No Attribution License
CONST START = "^^"
LIST letters = (a), (b), (c), (d), (e), (f), (g), (h), (i), (j), (k), (l), (m), (n), (o), (p), (q), (r), (s), (t), (u), (v), (w), (x), (y), (z), /*
*/ A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z
Here is an example of the word "hello" capitalised: {capitalise_start("hello")}
EXTERNAL tunnelDepth()
=== function tunnelDepth()
// Tunnel Depth not supported in inky!
~ return 1
=== tunnelOut(-> thenGoTo)
{ tunnelDepth() > 1:
// Tunnelling out!
->-> tunnelOut(thenGoTo)
}
@joningold
joningold / quickRelations.ink
Last active September 7, 2025 03:54
Quick way to create, query and remove relations between list items
~ relate(Key, MadeOf, Copper)
~ relate((Padlock, Spear), MadeOf, Iron)
~ relate(GoldCoin, MadeOf, Gold)
VAR Inventory = ()
- (top)