Writing with Ink – Lists with an Oxford Comma

The guys at Inkle Studios have shared their method for printing a list using a recursion function on their Patreon page, but I found an easier method to insert an Oxford Comma when printing a list.

{LIST_COUNT(IsPresent):
   - 0: No one is here. 
   - 1: Only {IsPresent} is here. 
   - 2: {LIST_MIN(IsPresent)} and {LIST_MAX(IsPresent)} are here. 
   - else: {IsPresent-LIST_MAX(IsPresent)}, and {LIST_MAX(IsPresent)} are here. 
}

In this example I’m grabbing the LIST_COUNT of IsPresent, and printing the contents  according to how many items there are.

With 3 or more in the list I subtract the LIST_MAX (the last item in the list) from the full list before printing, then insert a comma before printing the LIST_MAX.

Writing with Ink – Runtime Loop

I’ve written an old knock-knock joke into an Ink script to show a basic runtime loop. The logic here is simple: tell a joke three times, but the third time with a different ending.

I define the loop start with an index: joke.

The loop gate has two settings: closed diverts the runtime to the start of the loop, open (or unlocked) allows the runtime to proceed. My start state is closed. On the third try it will open.

CONST punchline = 3 

- (joke) Knock knock! 
+ Who is there? 
- {joke<punchline: 
   Banana. 
   + Banana Who? 
      -> joke 
   - else: 
   Orange. 
   * Orange Who? 
      Orange you glad I didn't say banana? 
}

My conditional test doesn’t use variables, although the loop gate looks as if joke and punchline are variables. Ink is counting how many times the index joke has been seen and comparing it against a constant value called punchline. When joke is less than punchline the loop is closed.

joke<punchline

Things to know:

  • A constant looks like a variable in Ink script, but it isn’t dynamic. At runtime it is replaced with the value it represents. Constants are for scripting convenience.
  • The index cannot be addressed from outside this knot, but leaving and coming back to the knot will preserve the seen count.

Bforartists

Bforartists stands for Be For Artists. A reminder to develop for the user, not the programmer.

Bforartists 1.0 is a fork of the open source 3d software Blender, with the full feature set of Blender 2.8 being represented by icons and a GUI interface, including some 90-odd commands that were previously key-stroke only.

Other interface quirks of Blender – like right-click to select and 4-finger keystrokes, are now more accessible to the casual user and indie artist who must be a jack of all trades.

BforArtist is available for Windows and osX (unbuilt Unix version is available on github)
https://www.bforartists.de