Python script and a LaTeX-y syntax for writing short interactive fictions ("choose your own adventure" kind)
A simple LaTeX-y syntax for writing short interactive fictions.
Three types of entry:
\scene
: the main descriptions can be written here \actions
: a set of possibilities the player has to choose from \reaction
: what happens (mostly) after an action has been chosen. They can be timed (++
symbol), either by specifying an optional parameter for the whole entry or for a single line only.\def
\scene
and \reaction
you’ll need to specify to the program where to look next (the next command, without specifying \def
)\actions
entry you’ll need a <<
for every line of text; the next command can be specified right after every line of text<<[\oneshot]
: this way after the action is performed it will not be available anymore\reaction
entries you can specify in squared brackets, right after the name, the time in seconds that every ++
line will wait before being displayed. As an alternative you can specify that number in squared brackets after the double plus symbol (++[2]
) \BEGIN\scene{<entryName>}
\ENDGAME
as the next command (yes, in Caps: you’re screaming to the computer).A short working example of the content of the text file
\BEGIN\scene{somewhere}
\def\scene{somewhere}{
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
}\actions{actionsName}
\def\actions{actionsName}{
<< Do something \reaction{something}
<< Go to some place \scene{somePlace}
}
\def\reaction{something}[1]{
You do something.
++ Bad consequences
++ happening after 1 second as specified
++ or
++[3] even a different time.
} \actions{actionsName}
\def\scene{somePlace}{
You win. Happy feelings.
}\ENDGAME
This is my first proper Python project; let me save you some time.
Look somewhere else if: