\documentclass[10pt,a4paper]{article} % Packages \usepackage{fancyhdr} % For header and footer \usepackage{multicol} % Allows multicols in tables \usepackage{tabularx} % Intelligent column widths \usepackage{tabulary} % Used in header and footer \usepackage{hhline} % Border under tables \usepackage{graphicx} % For images \usepackage{xcolor} % For hex colours %\usepackage[utf8x]{inputenc} % For unicode character support \usepackage[T1]{fontenc} % Without this we get weird character replacements \usepackage{colortbl} % For coloured tables \usepackage{setspace} % For line height \usepackage{lastpage} % Needed for total page number \usepackage{seqsplit} % Splits long words. %\usepackage{opensans} % Can't make this work so far. Shame. Would be lovely. \usepackage[normalem]{ulem} % For underlining links % Most of the following are not required for the majority % of cheat sheets but are needed for some symbol support. \usepackage{amsmath} % Symbols \usepackage{MnSymbol} % Symbols \usepackage{wasysym} % Symbols %\usepackage[english,german,french,spanish,italian]{babel} % Languages % Document Info \author{menaechmi (menaechmi)} \pdfinfo{ /Title (ink-1-2-0-inky-0-15.pdf) /Creator (Cheatography) /Author (menaechmi (menaechmi)) /Subject (Ink 1.2.0/Inky 0.15 Cheat Sheet) } % Lengths and widths \addtolength{\textwidth}{6cm} \addtolength{\textheight}{-1cm} \addtolength{\hoffset}{-3cm} \addtolength{\voffset}{-2cm} \setlength{\tabcolsep}{0.2cm} % Space between columns \setlength{\headsep}{-12pt} % Reduce space between header and content \setlength{\headheight}{85pt} % If less, LaTeX automatically increases it \renewcommand{\footrulewidth}{0pt} % Remove footer line \renewcommand{\headrulewidth}{0pt} % Remove header line \renewcommand{\seqinsert}{\ifmmode\allowbreak\else\-\fi} % Hyphens in seqsplit % This two commands together give roughly % the right line height in the tables \renewcommand{\arraystretch}{1.3} \onehalfspacing % Commands \newcommand{\SetRowColor}[1]{\noalign{\gdef\RowColorName{#1}}\rowcolor{\RowColorName}} % Shortcut for row colour \newcommand{\mymulticolumn}[3]{\multicolumn{#1}{>{\columncolor{\RowColorName}}#2}{#3}} % For coloured multi-cols \newcolumntype{x}[1]{>{\raggedright}p{#1}} % New column types for ragged-right paragraph columns \newcommand{\tn}{\tabularnewline} % Required as custom column type in use % Font and Colours \definecolor{HeadBackground}{HTML}{333333} \definecolor{FootBackground}{HTML}{666666} \definecolor{TextColor}{HTML}{333333} \definecolor{DarkBackground}{HTML}{D16858} \definecolor{LightBackground}{HTML}{FCF5F4} \renewcommand{\familydefault}{\sfdefault} \color{TextColor} % Header and Footer \pagestyle{fancy} \fancyhead{} % Set header to blank \fancyfoot{} % Set footer to blank \fancyhead[L]{ \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{C} \SetRowColor{DarkBackground} \vspace{-7pt} {\parbox{\dimexpr\textwidth-2\fboxsep\relax}{\noindent \hspace*{-6pt}\includegraphics[width=5.8cm]{/web/www.cheatography.com/public/images/cheatography_logo.pdf}} } \end{tabulary} \columnbreak \begin{tabulary}{11cm}{L} \vspace{-2pt}\large{\bf{\textcolor{DarkBackground}{\textrm{Ink 1.2.0/Inky 0.15 Cheat Sheet}}}} \\ \normalsize{by \textcolor{DarkBackground}{menaechmi (menaechmi)} via \textcolor{DarkBackground}{\uline{cheatography.com/211056/cs/45645/}}} \end{tabulary} \end{multicols}} \fancyfoot[L]{ \footnotesize \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{LL} \SetRowColor{FootBackground} \mymulticolumn{2}{p{5.377cm}}{\bf\textcolor{white}{Cheatographer}} \\ \vspace{-2pt}menaechmi (menaechmi) \\ \uline{cheatography.com/menaechmi} \\ \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Cheat Sheet}} \\ \vspace{-2pt}Not Yet Published.\\ Updated 14th February, 2025.\\ Page {\thepage} of \pageref{LastPage}. \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Sponsor}} \\ \SetRowColor{white} \vspace{-5pt} %\includegraphics[width=48px,height=48px]{dave.jpeg} Measure your website readability!\\ www.readability-score.com \end{tabulary} \end{multicols}} \begin{document} \raggedright \raggedcolumns % Set font size to small. Switch to any value % from this page to resize cheat sheet text: % www.emerson.emory.edu/services/latex/latex_169.html \footnotesize % Small font. \begin{multicols*}{3} \begin{tabularx}{5.377cm}{x{1.89126 cm} x{3.08574 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Comments}} \tn % Row 0 \SetRowColor{LightBackground} //Comment & Single Line Comment \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} /*\{\{nl\}\}Comment\{\{nl\}\}*/ & \{\{nl\}\}Multi-line comment \tn % Row Count 3 (+ 2) % Row 2 \SetRowColor{LightBackground} TODO: Reminder! & Printed during compilation: Reminder! \tn % Row Count 5 (+ 2) % Row 3 \SetRowColor{white} \# Tag & Creates a tag, accessible from the runtime \tn % Row Count 7 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.46464 cm} x{1.55618 cm} x{1.55618 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{5.377cm}}{\bf\textcolor{white}{Choices}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{3}{x{5.377cm}}{Prompt\{\{nl\}\}*/+ (label) \{condition\} {[}option{]}\{\{nl\}\}~~~Response} \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} + {\bf{(}}label{\bf{)}} Option & Options can be given a label & \tn % Row Count 5 (+ 3) % Row 2 \SetRowColor{LightBackground} {\bf{*}} & Option only shows up once & \tn % Row Count 7 (+ 2) % Row 3 \SetRowColor{white} {\bf{+}} & "sticky" option - can be chosen multiple times & \tn % Row Count 11 (+ 4) % Row 4 \SetRowColor{LightBackground} & Prompt\{\{nl\}\}* Option 1\{\{nl\}\}* Option 2 & Prompt\{\{nl\}\}1: Option 1\{\{nl\}\}2: Option 2 \tn % Row Count 15 (+ 4) % Row 5 \SetRowColor{white} */+ Option\{\{nl\}\}~~Response & Responses are written with text on a new line & \tn % Row Count 19 (+ 4) % Row 6 \SetRowColor{LightBackground} & Prompt\{\{nl\}\}*~ A\{\{nl\}\}~~~1\{\{nl\}\}+~B\{\{nl\}\}~~~2 & Prompt\{\{nl\}\}1: A\{\{nl\}\}2: B\{\{nl\}\}\textgreater{}2 B\{\{nl\}\}2 \tn % Row Count 26 (+ 7) % Row 7 \SetRowColor{white} */+ {[}Option{]} & Options in bracket are displayed in choice list, not in output & \tn % Row Count 31 (+ 5) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{5.377cm}{x{1.46464 cm} x{1.55618 cm} x{1.55618 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{5.377cm}}{\bf\textcolor{white}{Choices (cont)}} \tn % Row 8 \SetRowColor{LightBackground} & 1: Option\{\{nl\}\}\textgreater{}1\{\{nl\}\} & \tn % Row Count 2 (+ 2) % Row 9 \SetRowColor{white} */+ A {[}B{]} & Text before bracket is displayed in both choice list and output & \tn % Row Count 7 (+ 5) % Row 10 \SetRowColor{LightBackground} & 1: A B\{\{nl\}\}\textgreater{}1 A & \tn % Row Count 9 (+ 2) % Row 11 \SetRowColor{white} */+ A {[}B{]} C & Text after brackets is only shown in output & \tn % Row Count 13 (+ 4) % Row 12 \SetRowColor{LightBackground} & 1: A B\{\{nl\}\}\textgreater{}1 A C & \tn % Row Count 15 (+ 2) % Row 13 \SetRowColor{white} & */+ Hello{[}.{]} , how are you? & 1: Hello.\{\{nl\}\}1\textgreater{} Hello, how are you? \tn % Row Count 18 (+ 3) % Row 14 \SetRowColor{LightBackground} */+ \{condition\} {[}option{]} & If condition = true, display option & \tn % Row Count 21 (+ 3) % Row 15 \SetRowColor{white} & * \{a\} {[}a{]}\{\{nl\}\}* b & If a = true:\{\{nl\}\}1. a\{\{nl\}\}2. b\{\{nl\}\}If a = false:\{\{nl\}\} 1. b \tn % Row Count 26 (+ 5) % Row 16 \SetRowColor{LightBackground} */+ -\textgreater{} knot & Fallback option. Never displayed to player, \seqsplit{automatically} used & \tn % Row Count 31 (+ 5) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{5.377cm}{x{1.46464 cm} x{1.55618 cm} x{1.55618 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{5.377cm}}{\bf\textcolor{white}{Choices (cont)}} \tn % Row 17 \SetRowColor{LightBackground} Fallback without diverting to a knot & *A\{\{nl\}\}Nothing\{\{nl\}\}* -\textgreater{}\{\{nl\}\}You Died\{\{nl\}\}-\textgreater{} END & 1. A\{\{nl\}\}\textgreater{}1 A\{\{nl\}\}Nothing\{\{nl\}\}You Died. \tn % Row Count 5 (+ 5) % Row 18 \SetRowColor{white} {\bf{-}} (label) Content & "Gather" all choices back to this point. See Content Flow for more information. & \tn % Row Count 12 (+ 7) \hhline{>{\arrayrulecolor{DarkBackground}}---} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.89126 cm} x{3.08574 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Glue}} \tn % Row 0 \SetRowColor{LightBackground} {\bf{\textless{}\textgreater{}}} & "Glue", skips automatic line-break \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} This is a\{\{nl\}\}line break & This is a\{\{nl\}\} line break \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} This is \textless{}\textgreater{}\{\{nl\}\}glue & This is glue \tn % Row Count 6 (+ 2) % Row 3 \SetRowColor{white} \mymulticolumn{2}{x{5.377cm}}{This is midsentence\textless{}\textgreater{} -\textgreater{} glue\{\{nl\}\}=== glue\{\{nl\}\}divert with glue} \tn % Row Count 8 (+ 2) % Row 4 \SetRowColor{LightBackground} & This is midsentence divert with glue \tn % Row Count 10 (+ 2) % Row 5 \SetRowColor{white} \mymulticolumn{2}{x{5.377cm}}{This is midsentence-\textgreater{} noglue\{\{nl\}\}=== divert\{\{nl\}\}divert without glue} \tn % Row Count 12 (+ 2) % Row 6 \SetRowColor{LightBackground} & This is midsentence\{\{nl\}\}divert without glue \tn % Row Count 14 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.84149 cm} x{3.13551 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Functions}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{Functions add a call stack and optional return values to knots} \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} \mymulticolumn{2}{x{5.377cm}}{{\bf{=== function}} name(parameters) {\bf{===}} \{\{nl\}\} function body\{\{nl\}\}{\bf{\textasciitilde{} return}} return\_value} \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} {\bf{name()}} & Functions are always called with parentheses \tn % Row Count 6 (+ 2) % Row 3 \SetRowColor{white} \{\{noshy\}\}a\{letter(b)\}c & Functions are called with \textless{}\textgreater{} glue by default \tn % Row Count 8 (+ 2) % Row 4 \SetRowColor{LightBackground} {\bf{(ref}} parameter{\bf{)}} & Pass parameter by reference, default behavior is by value \tn % Row Count 11 (+ 3) % Row 5 \SetRowColor{white} \mymulticolumn{2}{x{5.377cm}}{Functions cannot contain stitches, choices, or diverts} \tn % Row Count 13 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{Safe to use recursively. See Variables for details.} \tn \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{2.14011 cm} x{2.83689 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{"Standard Libary" functions}} \tn % Row 0 \SetRowColor{LightBackground} \{\{noshy\}\}{\bf{CHOICE\_COUNT()}} & Number of options currently being presented \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} {\bf{TURNS()}} & Total number of player choices of the game \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} {\bf{TURNS\_SINCE(-\textgreater{} knot)}} & Number of player choices since a knot was seen, -1 has never been seen, 0 is current. \tn % Row Count 8 (+ 4) % Row 3 \SetRowColor{white} \{\{noshy\}\}{\bf{SEED\_RANDOM(seed)}} & Fixes the random number generator to produce the same outcomes \tn % Row Count 11 (+ 3) % Row 4 \SetRowColor{LightBackground} {\bf{READ\_COUNT(-\textgreater{} knot)}} & Number of times knot has been seen. \{\{nl\}\} Equivalent to {\bf{\{knot\}}} \tn % Row Count 15 (+ 4) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{2.18988 cm} x{2.78712 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{List Functions}} \tn % Row 0 \SetRowColor{LightBackground} {\bf{LIST\_VALUE(list.item)}} & Prints item's position in list 1-indexed \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} {\bf{LIST\_ALL(list)}} & List all values in list \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{Multivalue list functions assume an active element. Use LIST\_ALL(list) for other lists} \tn % Row Count 6 (+ 2) % Row 3 \SetRowColor{white} {\bf{LIST\_COUNT(mvlist)}} & Count active item \tn % Row Count 8 (+ 2) % Row 4 \SetRowColor{LightBackground} {\bf{LIST\_MIN(mvlist)}} & Get active item with the lowest index \tn % Row Count 10 (+ 2) % Row 5 \SetRowColor{white} {\bf{LIST\_MAX(mvlist)}} & Get active item with the highest index \tn % Row Count 12 (+ 2) % Row 6 \SetRowColor{LightBackground} \{\{noshy\}\}{\bf{LIST\_RANDOM(mvlist)}} & Get a random active item in list \tn % Row Count 14 (+ 2) % Row 7 \SetRowColor{white} {\bf{LIST\_RANGE(mvlist, min, max)}} & Gets the inclusive values between min and max. Min/max can be integers or list items. \tn % Row Count 18 (+ 4) % Row 8 \SetRowColor{LightBackground} {\bf{LIST\_INVERT(mvlist)}} & Flips active and inactive. Empty list returns null \tn % Row Count 21 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{2.04057 cm} x{2.93643 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Math Functions}} \tn % Row 0 \SetRowColor{LightBackground} {\bf{INT(x)}}, {\bf{FLOAT(x)}} & Cast x to type \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} {\bf{FLOOR(x)}} & Round x down to nearest integer. (-1.5 rounds to -2) \tn % Row Count 5 (+ 3) % Row 2 \SetRowColor{LightBackground} {\bf{POW(x,y)}} & Raises x to the y power \tn % Row Count 6 (+ 1) % Row 3 \SetRowColor{white} \{\{noshy\}\}{\bf{RANDOM(min,max)}} & Generates a number between min and max, inclusive \tn % Row Count 9 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{2.4885 cm} x{2.4885 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Knot/Stitch}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{{\bf{===~}}label(parameter)~{\bf{===}}\{\{nl\}\}Content} \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} {\bf{===}}~label~{\bf{*===}} & Creates "knot" named label \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} {\bf{===}} label & Shorthand to create knot \tn % Row Count 6 (+ 2) % Row 3 \SetRowColor{white} {\bf{-\textgreater{}}} label & Divert, divert arrow. Redirects flow to label \tn % Row Count 9 (+ 3) % Row 4 \SetRowColor{LightBackground} === knot\{\{nl\}\}{\bf{= stitch\_label}}\{\{nl\}\}Stitch Content & "Stitch", a subsection of a knot. \tn % Row Count 12 (+ 3) % Row 5 \SetRowColor{white} === label{\bf{(p1, p2)}} & Optional parameter for knots or stitches. \tn % Row Count 15 (+ 3) % Row 6 \SetRowColor{LightBackground} -\textgreater{} knot(a,b) & Divert to knot with parameters \tn % Row Count 17 (+ 2) % Row 7 \SetRowColor{white} === knot({\bf{-\textgreater{}}} a)\{\{nl\}\}-\textgreater{} a & Use a divert as a parameter \tn % Row Count 19 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{Diverts are explained in more detail in Control Flow} \tn \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{2.4885 cm} x{2.4885 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Math/Logic}} \tn % Row 0 \SetRowColor{LightBackground} {\bf{\textasciitilde{}}} & Indicates the line is not text \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} {\bf{+}} {\bf{-}} {\bf{/}} {\bf{*}} & Basic math operators, addition, subtration, multiplication, division \tn % Row Count 6 (+ 4) % Row 2 \SetRowColor{LightBackground} {\bf{and}}, {\bf{or}}, {\bf{not}}\{\{nl\}\}{\bf{\&\&}}, {\bf{||}}, {\bf{!}} & Logical operators.\{\{nl\}\}Symbol versions will not work in all contexts. \tn % Row Count 10 (+ 4) % Row 3 \SetRowColor{white} \textbackslash{}\textasciitilde{} variable{\bf{++}}\{\{nl\}\}\textbackslash{}\textasciitilde{} variable{\bf{-{}-}} & Increment variable +1\{\{nl\}\}Decrement variable -1 \tn % Row Count 13 (+ 3) % Row 4 \SetRowColor{LightBackground} {\bf{\%}} & Mod operator, returns the remainder after division. \tn % Row Count 16 (+ 3) % Row 5 \SetRowColor{white} \textasciitilde{} x = 2/3 & Math types are implicit, so x is 0 \tn % Row Count 18 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{2.33919 cm} x{2.63781 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Special Diverts}} \tn % Row 0 \SetRowColor{LightBackground} \{\{width=25\}\}{\bf{-\textgreater{}~END}} & End the story. CSS class `.end` \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} {\bf{-\textgreater{}~DONE}} & Flow ends intentionally \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{Diverts are case sensitive: `-\textgreater{} DONE` and `-\textgreater{} Done` and `-\textgreater{} DoNe` are all separate} \tn % Row Count 6 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{2.4885 cm} x{2.4885 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Conditionals}} \tn % Row 0 \SetRowColor{LightBackground} {\bf{\{}}\{\{nl\}\}conditional \{\{nl\}\}{\bf{\}}} & Conditionals take place inside of curly brackets, and can control story content \tn % Row Count 4 (+ 4) % Row 1 \SetRowColor{white} {\bf{\textgreater{}}}, {\bf{\textless{}}}, {\bf{\textgreater{}=}}, {\bf{\textless{}=}}, {\bf{==}}, \{\{nl\}\}{\bf{!=}} & Standard operators \tn % Row Count 7 (+ 3) % Row 2 \SetRowColor{LightBackground} \{\{noshy\}\}"a"{\bf{==}}"a", \{\{nl\}\}"a"{\bf{!=}}"b", "ab"{\bf{?}}"a" & String queries. Equal, inequal, contains \tn % Row Count 10 (+ 3) % Row 3 \SetRowColor{white} {\bf{\{}}condition{\bf{:}} true\{\{nl\}\}{\bf{- else:}}\{\{nl\}\}false\{\{nl\}\}{\bf{\}}} & If-else statement. The else is optional \tn % Row Count 14 (+ 4) % Row 4 \SetRowColor{LightBackground} {\bf{\{ - }}condition1{\bf{:}} statement1\{\{nl\}\}{\bf{-}} condition2{\bf{:}} statement2\{\{nl\}\}{\bf{- else:}} statement{\bf{\}}} & If/else if/ else statement. Evaluates in order \tn % Row Count 20 (+ 6) % Row 5 \SetRowColor{white} {\bf{\{ }}x{\bf{:}}\{\{nl\}\}{\bf{- }}0{\bf{:}} zero\{\{nl\}\} {\bf{-}} 1{\bf{:}} one\{\{nl\}\}{\bf{-}} 2{\bf{:}} two\{\{nl\}\}{\bf{- else:}} lots {\bf{\}}} & Case statement \tn % Row Count 26 (+ 6) % Row 6 \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{All labels are read counts of the content.} \tn % Row Count 27 (+ 1) % Row 7 \SetRowColor{white} \{label:...\}\{\{nl\}\}\{!label:...\} & Has knot been visited?\{\{nl\}\} Is knot unvisited? \tn % Row Count 30 (+ 3) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{5.377cm}{x{2.4885 cm} x{2.4885 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Conditionals (cont)}} \tn % Row 8 \SetRowColor{LightBackground} \{label \textgreater{} x:...\} & Has the knot been seen more than x times? \tn % Row Count 3 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{2.33919 cm} x{2.63781 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Lists}} \tn % Row 0 \SetRowColor{LightBackground} {\bf{LIST}} list = a, b & Create a list and a variable \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} {\bf{LIST}} list = a, (default) & Parenthesis selects state at assignment \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} var = a & Assign value a from list \tn % Row Count 6 (+ 2) % Row 3 \SetRowColor{white} var = list.a & Specify which list with selectors \tn % Row Count 8 (+ 2) % Row 4 \SetRowColor{LightBackground} \{list.a\}\{\{nl\}\}\{list(1)\} & List values print as names. Both a in this case. \tn % Row Count 11 (+ 3) % Row 5 \SetRowColor{white} LIST numbers = one =1, two, five = 5 & Set custom list numbering. Skipped numbers increment by one (1). \tn % Row Count 15 (+ 4) % Row 6 \SetRowColor{LightBackground} var++ & Point to next item in list \tn % Row Count 17 (+ 2) % Row 7 \SetRowColor{white} var-{}- & Point to previous item in list \tn % Row Count 19 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{2.4885 cm} x{2.4885 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Mutlivalue Lists}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{Multivalue Lists are lists with references to multiple list items. Items in the list are "active"} \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} mvlist = (a), (b)\{\{nl\}\}mvlist = (a, b)\{\{nl\}\}mvlist = (a = 1), (b) =2 & Set active items \tn % Row Count 6 (+ 4) % Row 2 \SetRowColor{LightBackground} mvlist {\bf{+=}} a\{\{nl\}\}mvlist {\bf{+=}} (a, b) & Add items to the list to activate them \tn % Row Count 9 (+ 3) % Row 3 \SetRowColor{white} mvlist {\bf{-=}} a\{\{nl\}\}mvlist {\bf{-=}} (a,b) & Remove items from the list to deactivate them \tn % Row Count 12 (+ 3) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{Referencing a multivalue list is assumed to refer to active states only.} \tn % Row Count 14 (+ 2) % Row 5 \SetRowColor{white} \{ mvlist: has active | no active\} & Conditionals are true if any state is active \tn % Row Count 17 (+ 3) % Row 6 \SetRowColor{LightBackground} \{ mvlist == (1,2): exactly 1,2 | not exactly 1,2\} & Equality checks if an exact set is matched. 1,2,3 and 1 will both fail here. \tn % Row Count 21 (+ 4) % Row 7 \SetRowColor{white} \{ mvlist has a:\{\{nl\}\}\{ mvlist ? (a,b) & Has all (?)\{\{nl\}\}(a AND b) \tn % Row Count 23 (+ 2) % Row 8 \SetRowColor{LightBackground} \{mvlist hasnt (a,b):\{\{nl\}\} \{mvlist !? a & Hasnt all (!?)\{\{nl\}\}(!a AND !b) \tn % Row Count 25 (+ 2) % Row 9 \SetRowColor{white} list\_a \textasciicircum{} list\_b & Intersection (\textasciicircum{})\{\{nl\}\}Has some \tn % Row Count 27 (+ 2) % Row 10 \SetRowColor{LightBackground} statelist () ? & Returns false \tn % Row Count 28 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.78503 cm} x{1.00694 cm} x{1.78503 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{5.377cm}}{\bf\textcolor{white}{Content Alternatives}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{3}{x{5.377cm}}{\{\{noshy\}\}Most alternatives have two syntaxes, symbolic and multi-line block (indicated as {\bf{\{~alternate:}}) which requires each option to start with "{\bf{-}}"} \tn % Row Count 4 (+ 4) % Row 1 \SetRowColor{white} {\bf{\{}}1,2,3{\bf{\}}}\{\{nl\}\}{\bf{\{ stopping:}} & 1,2,3,3,3,3... & Stopping Sequence - repeats last option when out \tn % Row Count 8 (+ 4) % Row 2 \SetRowColor{LightBackground} {\bf{\{\&}}1,2,3{\bf{\}}}\{\{nl\}\}{\bf{\{ cycle:}} & 1,2,3,1,2,3... & Cycle - repeats options when out \tn % Row Count 11 (+ 3) % Row 3 \SetRowColor{white} {\bf{\{!}}1{\bf{\}}} & 1 & Once-only \tn % Row Count 12 (+ 1) % Row 4 \SetRowColor{LightBackground} {\bf{\{!}}1,2,3{\bf{\}}}\{\{nl\}\}{\bf{\{ once:}} & 1,2,3 & Once-only sequence \tn % Row Count 15 (+ 3) % Row 5 \SetRowColor{white} {\bf{\{\textasciitilde{}}}heads,tails{\bf{\}}}\{\{nl\}\}{\bf{\{ shuffle:}} & heads, heads, \seqsplit{tails...} & Shuffle - chooses from options each time \tn % Row Count 18 (+ 3) % Row 6 \SetRowColor{LightBackground} {\bf{\{ shuffle stopping:}}\{\{nl\}\}{\bf{-}} a\{\{nl\}\}{\bf{-}} b\{\{nl\}\}{\bf{-}} c{\bf{\}}} & b,a,c,c,c... & Shuffles all but the last entry, plays through it, and then repeats the last entry \tn % Row Count 24 (+ 6) % Row 7 \SetRowColor{white} {\bf{\{ shuffle once:}}\{\{nl\}\}{\bf{-}} a\{\{nl\}\}{\bf{-}} b\{\{nl\}\}{\bf{-}} c{\bf{\}}} & b,c,a & Shuffles the list and plays through it one time \tn % Row Count 29 (+ 5) % Row 8 \SetRowColor{LightBackground} \{,,3\} & ,,3 & Empty options don't display \tn % Row Count 31 (+ 2) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{5.377cm}{x{1.78503 cm} x{1.00694 cm} x{1.78503 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{5.377cm}}{\bf\textcolor{white}{Content Alternatives (cont)}} \tn % Row 9 \SetRowColor{LightBackground} \{\&a,\{!2\},c\} & a,2,c,a,c & Alternatives can be nested \tn % Row Count 2 (+ 2) % Row 10 \SetRowColor{white} \{1,2, -\textgreater{}a\} & 1, 2, a & Alternatives can use diverts \tn % Row Count 4 (+ 2) % Row 11 \SetRowColor{LightBackground} + a \{!b,c\} & 1. a b\{\{nl\}\}1. a c & Choices can use alternatives \tn % Row Count 7 (+ 3) % Row 12 \SetRowColor{white} +\textbackslash{} \{\&a,b\} & 1. a\{\{nl\}\}1. b & Escape whitespace with "\textbackslash{}" to start choices with alternative \tn % Row Count 11 (+ 4) \hhline{>{\arrayrulecolor{DarkBackground}}---} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.94103 cm} x{3.03597 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Variables}} \tn % Row 0 \SetRowColor{LightBackground} {\bf{VAR}} name {\bf{=}} value & Global variable. Accessible from the runtime and the story. \tn % Row Count 3 (+ 3) % Row 1 \SetRowColor{white} {\bf{CONST}} NAME {\bf{=}} value & Defines a variable that cannot be changed \tn % Row Count 5 (+ 2) % Row 2 \SetRowColor{LightBackground} {\bf{\textasciitilde{}}} & Used for lines that are game logic, not text \tn % Row Count 7 (+ 2) % Row 3 \SetRowColor{white} {\bf{\textasciitilde{} temp}} name = value & Temporary variable. Stitch-level context \tn % Row Count 9 (+ 2) % Row 4 \SetRowColor{LightBackground} {\bf{\textasciitilde{}}} name {\bf{=}} value & Change the value of a variable \tn % Row Count 11 (+ 2) % Row 5 \SetRowColor{white} {\bf{\{}}name{\bf{\}}} & Curly brackets print variables in text \tn % Row Count 13 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{Temporary variables are safe to use in recursion. Globals are not. See Functions for details.} \tn \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{2.43873 cm} x{2.53827 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Variable types}} \tn % Row 0 \SetRowColor{LightBackground} 1,2,3 & Integer \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} 0.5,0.9.0,6 & Floating point \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} true, false & Boolean (lowercase only) \tn % Row Count 4 (+ 2) % Row 3 \SetRowColor{white} -\textgreater{} knot, -\textgreater{} knot.stitch & Story Address/Divert \tn % Row Count 6 (+ 2) % Row 4 \SetRowColor{LightBackground} "a", "a b", "\{\textasciitilde{}a|b|c\}" & Content \tn % Row Count 8 (+ 2) % Row 5 \SetRowColor{white} \mymulticolumn{2}{x{5.377cm}}{Type Content can contain ink, but are evaluted to a string based on seed. `VAR var = "\{a|b\}"` is therefore not allowed} \tn % Row Count 11 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{Variables are also used to reference lists. See Lists and Multivalue Lists for details.} \tn \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{2.4885 cm} x{2.4885 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Control Flow}} \tn % Row 0 \SetRowColor{LightBackground} {\bf{Start}}\{\{nl\}\}===knot1 & Ink tries to start a story from anything not in a knot \tn % Row Count 3 (+ 3) % Row 1 \SetRowColor{white} {\bf{-\textgreater{} start}}\{\{nl\}\}===start & To start from within a knot, divert to the knot \tn % Row Count 6 (+ 3) % Row 2 \SetRowColor{LightBackground} === knot\{\{nl\}\}a\{\{nl\}\}=stitch\{\{nl\}\} & Knot control defaults to any content not under a stitch \tn % Row Count 9 (+ 3) % Row 3 \SetRowColor{white} === knot\{\{nl\}\}=stitch\{\{nl\}\}a\{\{nl\}\}= stitch2 & If there is no header content, the first stitch will play instead. \tn % Row Count 13 (+ 4) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{If a section ends without diverting, flow will end.} \tn % Row Count 15 (+ 2) % Row 5 \SetRowColor{white} {\bf{-\textgreater{} knot.stitch}} & Divert to a stitch using full address \tn % Row Count 17 (+ 2) % Row 6 \SetRowColor{LightBackground} {\bf{-\textgreater{} stitch\_b}} & Divert to stitch from within the same knot \tn % Row Count 20 (+ 3) % Row 7 \SetRowColor{white} \mymulticolumn{2}{x{5.377cm}}{Diverts can go to any labeled element} \tn % Row Count 21 (+ 1) % Row 8 \SetRowColor{LightBackground} *a\{\{nl\}\}++b\{\{nl\}\}**b\{\{nl\}\}*a\{\{nl\}\}++c & Choices (and content) can be nested, so that different choices have different outcomes. \tn % Row Count 26 (+ 5) % Row 9 \SetRowColor{white} {\bf{-}} {\bf{-}} (label) & Gathers can be nested. They will collect choices of the same or deeper lever. \tn % Row Count 30 (+ 4) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{See Tunnels and Threads for even more control flow options.} \tn \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{2.4885 cm} x{2.4885 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Tunnels}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{Tunnels return the story to where they were called, letting you reuse the same segment in different parts of the story or run sub-stories.} \tn % Row Count 3 (+ 3) % Row 1 \SetRowColor{white} content\{\{nl\}\}{\bf{-\textgreater{}}} tunnel {\bf{-\textgreater{}}}\{\{nl\}\} more content & Calling a tunnel. After the tunnel, continues at more content \tn % Row Count 7 (+ 4) % Row 2 \SetRowColor{LightBackground} {\bf{-\textgreater{}}} tunnel1 {\bf{-\textgreater{}}} tunnel2 {\bf{-\textgreater{}}} & You can chain calling tunnels \tn % Row Count 9 (+ 2) % Row 3 \SetRowColor{white} -\textgreater{} tunnel -\textgreater{} knot & Or divert elsewhere \tn % Row Count 10 (+ 1) % Row 4 \SetRowColor{LightBackground} === tunnel\{\{nl\}\}content\{\{nl\}\}{\bf{-\textgreater{}-\textgreater{}}} & Tunnels end with a double divert \tn % Row Count 12 (+ 2) % Row 5 \SetRowColor{white} \{\{noshy\}\}===tunnel\_a\{\{nl\}\}-\textgreater{} tunnel\_b -\textgreater{}\{\{nl\}\}-\textgreater{}-\textgreater{} & Tunnels can also divert, as long as it ends with a double divert \tn % Row Count 16 (+ 4) % Row 6 \SetRowColor{LightBackground} {\bf{-\textgreater{}-\textgreater{}}} knot & Go to knot instead of returning the tunnel \tn % Row Count 19 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{Safe to use recursively} \tn \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{2.4885 cm} x{2.4885 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Threads}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{Threads follow knots, collecting choices to present to the player at a single point. They can be used to split content up or fork a story.} \tn % Row Count 3 (+ 3) % Row 1 \SetRowColor{white} {\bf{\textless{}-}} knot\_name & Start a thread \tn % Row Count 4 (+ 1) % Row 2 \SetRowColor{LightBackground} \textless{}- knot1\{\{nl\}\}\textless{}- knot2\{\{nl\}\}{\bf{-\textgreater{} DONE}} & -\textgreater{} DONE Tells the compiler the story continues at the threads, not here. \tn % Row Count 8 (+ 4) % Row 3 \SetRowColor{white} \textless{}- Choice\_a\{\{nl\}\}\textless{}- Choice\_b\{\{nl\}\}\textless{}- Choice\_c\{\{nl\}\}-\textgreater{} DONE & 1. a\{\{nl\}\}2. b\{\{nl\}\}3. c\{\{nl\}\}Story continues at the choice made \tn % Row Count 12 (+ 4) % Row 4 \SetRowColor{LightBackground} \textless{}- Choice\_a\{\{nl\}\}\textless{}- Choice\_b\{\{nl\}\}\textless{}- Choice\_c\{\{nl\}\}more content & 1. a\{\{nl\}\}2. b\{\{nl\}\}3. c\{\{nl\}\}Story continues at more content \tn % Row Count 16 (+ 4) % Row 5 \SetRowColor{white} \mymulticolumn{2}{x{5.377cm}}{If using to present a choice in many places, it might be helpful to include a return location divert as a paramater.} \tn % Row Count 19 (+ 3) % Row 6 \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{= location\{\{nl\}\}\textless{}- common\_choice(-\textgreater{} location)\{\{nl\}\}* more\_choices...\{\{nl\}\}= common\_choice(-\textgreater{} return)} \tn % Row Count 21 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} % That's all folks \end{multicols*} \end{document}