Skip to content

Instantly share code, notes, and snippets.

@joningold
joningold / gist:44b6a07999f5b7083e2fdb4d9f998335
Created June 9, 2026 15:26
Collapsable inventory system in raw Ink
LIST Inventory = (Key), (Torch), (Amulet)
VAR lastUsed = ()
-> dark
= dark
It's dark. You can't see.
- (top)
-> useSomething ->
@joningold
joningold / quickRelations.ink
Last active February 4, 2026 07:40
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)
@joningold
joningold / gist:0a45fadb69e697ff34294a2aa8f06ce6
Last active February 4, 2026 07:39
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.
*/
@joningold
joningold / database_game.ink
Created March 1, 2025 11:11
A bare-bones implementation of the ink for a "database" style game.
The post-it note on the computer reads "Spring, 1922".
-> hub
=== hub
~ temp allFiles = LIST_ALL(Files)
- (loop)
~ temp file = pop(allFiles) // pop is an ink function from the "Ink" menu
{ Files ? file: // have you seen it? let's list the ones we've found.
@joningold
joningold / gist:43065b56ca3227b625cbb8c7274cde1a
Created July 4, 2025 10:30
Looping conversation blocks using implicit threads
The space elevator climbs slowly towards the stars.
- (opts)
<- talk_to_my_companion(-> opts)
* I look out of the window...
* I whistle a tune...
=== talk_to_my_companion(-> return_to)
// create a tunnel, so conversation blocks can end with simple tunnel returns
-> options -> return_to
@joningold
joningold / quiz.ink
Created September 25, 2018 18:38
Shuffled choices example
LIST PossibleFruits = Apple, Banana, Satsuma, Melon, Pear
- (anotherquiz)
One fruit in the fruit-bowl is fake. Can you guess which one?
~ temp correctAnswer = LIST_RANDOM(LIST_ALL(PossibleFruits))
- (anothergo)
~ temp timesLooped = 0
LIST Fruit = Apple, Banana, Orange, Lemon
VAR fruitSaladIndex = 0
- (top)
* [add apple ]
~ addToSalad(Apple)
* [ add banana ]
~ addToSalad(Banana)
* [ add orange ]
~ addToSalad(Orange)
@joningold
joningold / intToListItem.ink
Created May 27, 2022 08:49
Assigning Values to List Items
LIST Entrants = PabloPicasso, VanGogh, LucyPhillipsAged11
~ temp place = 3
- (loop)
{ stopping:
- "Third place in the art competition goes to..."
- "Second place goes to..."
- "And so the winner is..."
@joningold
joningold / swindlestones.ink
Last active February 21, 2022 22:31
Swindlestones: a game of liar's dice from the city of Kharé
#story: Swindlestones
#author: Jon Ingold
// Play this example online: https://7zjr87zk.play.borogove.io/
LIST Dice =
MeA1 = 11, MeA2, MeA3, MeA4,
MeB1 = 21, MeB2, MeB3, MeB4,
MeC1 = 31, MeC2, MeC3, MeC4,
MeD1 = 41, MeD2, MeD3, MeD4,
@joningold
joningold / list_pairkeys.ink
Last active November 19, 2021 05:29
Ink: here's a system that allows you to easily pair elements from two ink lists together - say, characteristics with people; weapons with materials; etc.
/*------------------------------------------------------------
RAWINT Keys
------------------------------------------------------------*/
LIST RawInts = RAWINT0 = 0, RAWINT1, RAWINT2, RAWINT3, RAWINT4, RAWINT5, RAWINT6, RAWINT7, RAWINT8, RAWINT9, RAWINT10, RAWINT11, RAWINT12, RAWINT13, RAWINT14, RAWINT15, RAWINT16, RAWINT17, RAWINT18, RAWINT19, RAWINT20, RAWINT21, RAWINT22, RAWINT23, RAWINT24, RAWINT25, RAWINT26, RAWINT27, RAWINT28, RAWINT29, RAWINT30, RAWINT31, RAWINT32, RAWINT33, RAWINT34, RAWINT35, RAWINT36, RAWINT37, RAWINT38, RAWINT39, RAWINT40, RAWINT41, RAWINT42, RAWINT43, RAWINT44, RAWINT45, RAWINT46, RAWINT47, RAWINT48, RAWINT49, RAWINT50, RAWINT51, RAWINT52, RAWINT53, RAWINT54, RAWINT55, RAWINT56, RAWINT57, RAWINT58, RAWINT59, RAWINT60, RAWINT61, RAWINT62, RAWINT63, RAWINT64, RAWINT65, RAWINT66, RAWINT67, RAWINT68, RAWINT69, RAWINT70, RAWINT71, RAWINT72, RAWINT73, RAWINT74, RAWINT75, RAWINT76, RAWINT77, RAWINT78, RAWINT79, RAWINT80, RAWINT81, RAWINT82, RAWINT83, RAWINT84, RAWINT85, RAWINT86, RA