Skip to content

Instantly share code, notes, and snippets.

@joningold
Created March 1, 2025 11:11
Show Gist options
  • Save joningold/7c0f01de78ecb9308e40034c30243f86 to your computer and use it in GitHub Desktop.
Save joningold/7c0f01de78ecb9308e40034c30243f86 to your computer and use it in GitHub Desktop.
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.
>> {file}
}
<- opt( file )
{ allFiles:
-> loop
}
= opt(file)
+ [ {file} ]
#CLEAR
~ Files += file // note the file has been read
-> knotForFile(file) -> hub
// That's the whole system (!) Here's some example data.
LIST Files = SPRING22, AUTUMN28, WINTER43
=== knotForFile(file)
{ file:
- SPRING22: -> _SPRING22 // knots and list items need different names
- AUTUMN28: -> _AUTUMN28
- WINTER43: -> _WINTER43
- else: [ {file} is missing a knot! ]
}
=== _SPRING22
Spring of '22 was my first introduction to the mysterious art of "future computing", in which - by using a special pen - one could write a file into a machine which did not yet exist. I did more six years later, when the leaves were falling.
->->
=== _AUTUMN28
By the Autumn of '28 I'd gotten really good at this, but then I got distracted until - some 15 years later - I sat by a Yuletide fire and did it again.
->->
=== _WINTER43
It was the winter of '43 and boy, what a year that was!
->->
/*
Takes the bottom element from a list, and returns it, modifying the list.
Returns the empty list () if the source list is empty.
Usage:
LIST fruitBowl = (apple), (banana), (melon)
I eat the {pop(fruitBowl)}. Now the bowl contains {fruitBowl}.
*/
=== function pop(ref _list)
~ temp el = LIST_MIN(_list)
~ _list -= el
~ return el
@joningold
Copy link
Author

Note that the ink is only half the game -- you also need to edit the interface in the playable webpage so that choices are hidden, and chosen by typing the text of the choice into a search box instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment