Skip to content

Chatscript

Poobslag edited this page Feb 25, 2022 · 33 revisions

Turbo Fat's dialog is written in a custom format called Chatscript. Chatscript is intended to be concise, intuitive for non-programmer humans to read, and easy for humans to type in a text editor.

Header

{"version": "2476", "filler": true}

This section is optional, and defines the chatscript format version and any other metadata fields for the conversation.

  • version: The version of the chatscript file format.
  • fixed_zoom: For cutscenes with moving characters or where background details are important, the fixed_zoom parameter locks the camera at a specific zoom level.
  • skip_if: An expression which causes a cutscene to be skipped if true. This avoids playing cutscenes which wouldn't make sense in certain circumstances.
  • filler: In story mode, creatures will space out long involved conversations with short filler conversations. This flag denotes a short filler conversation for story mode's business logic.

Location

[location]
outdoors

This section is optional and defines the location for a cutscene. It's unnecessary for non-cutscene conversations.

Destination

[destination]
outdoors

This section is optional and defines where the player ends up after a cutscene. It's unnecessary for non-cutscene conversations.

Characters

[characters]
player, p1, restaurant_1
sensei, s1, restaurant_4
(chef) bones, b, !restaurant_8

This section is optional and defines the creatures in the scene, aliases, and spawn IDs. It's used for cutscenes which need to define which characters are present and where they appear. It's unnecessary for regular conversations.

(<role>) <creature-id>, <creature-alias>, <spawn-id>

  • (<role>): The role of a creature in a cutscene, either chef or customer. This metadata ensures cutscenes are paired with appropriate levels.
  • <creature-id>: The ID of a creature in a cutscene.
  • <creature-alias>: (Optional) An abbreviated way to refer to the creature in dialog.
  • <spawn-id>: (Optional) The ID of the spawn location where this creature should spawn. This is necessary for cutscenes, but not needed for regular conversations.
    • If preceded with !, the creature will spawn invisible. This is useful for creatures which appear mid-cutscene.

Dialog

Every chatscript file contains a dialog section which defines the conversation's text, moods and branches.

Default dialog branch

p1: Well that was... good!
b: <_< Just good?

The dialog section begins with the default dialog branch, which does not have a header.

Types of dialog

Regular dialog

<speaker>: <mood> <text>

  • <speaker>: The alias or creature ID of the creature speaking the line. The special aliases player and sensei refer to the player and instructor.
  • <mood>: An emoticon defining the line's mood. See the full list of moods in the table below.
  • <text>: The text being spoken. / is a special 'lull character' which will not be shown, but will cause the dialog the pause briefly. This overrides the default behavior of pausing around punctuation.

Unspoken dialog

(<text>)

  • <text>: The text being showed to the player. This might be something they're thinking, or something happening which we can't show.

Dialog choices and redirection

b: /._. Ohhh. Actually, I really gotta work out tonight. I already missed two nights this week. I can't miss a third night.
[you_need_exercise] Yeah, you're looking a little chunky
[yay_exercise] That's some good discipline!
[boo_exercise] Well, can we hang out tomorrow?

Dialog can end in a list of one or more choices. If there is only one branch provided, this dialog branch will automatically redirect to that branch. If there are two or more branches, the player will be offered a choice.

[<branch-id>] [<branch-id>] <branch-mood> <branch-text>

  • <branch-id>: The ID of the dialog branch to switch to.
  • <mood>: (optional) An emoticon defining the line's mood. See the full list of moods in the table below. This is optional. If omitted, the mood will be the mood of the first line of dialog on the branch.
  • <branch_text>: (optional) The text to prompt the user with. This is optional. If omitted, the player will be presented with the first line of dialog on the branch.

Additional dialog branches

[you_need_exercise]
p1: /._. Heh yeah, I thought you were looking a little chunky around the middle.
b: .__.; W-what!?!

Additional dialog branches begin with a header.

[<branch-id>]

  • <branch-id>: The branch ID. Other branches of dialog should use this ID when redirecting to this branch.

Dialog metadata

john: What do you think of my new hat?
 (john enters, jane enters)
john: Stop judging me!
 (john exits)
 (jane exits)
  • <metadata>: Metadata about the preceding line of dialog. This might include creature behaviors or control flow logic. A comprehensive list of metadata entries is listed below.

Multiple metadata items can be arranged on the same line or multiple lines:

 (<metadata>, <metadata>)

or,

 (<metadata>)
 (<metadata>)

Note the leading space at the start of each line.

Comments

p1: Hello! Hey, over here!
// this first chat choice is only accessible once
[huh] Huh? Are you talking to me?
 (link_if not chat_finished chat/boatricia/hi)

Beginning a line with // denotes a comment. Comments can appear anywhere in the chatscript file.

Moods

This mood table is generated by chatscript-table-demo.gd

mood 1 2 3
awkward0 <_< >_>
awkward1 <__< >__>
cry0 u_u T_T Q_Q
cry1 u__u T__T Q__Q
default ._.
laugh0 ^o^
laugh1 ^O^
love0 owo
love1 OwO
love1_forever OwO...
no0 ^n^
no1 ^N^
rage0 >_<
rage1 >__<
rage2 >___<
sigh0 -_-
sigh1 -__-
smile0 ^_^
smile1 ^__^
sweat0 ._.; -_-;
sweat1 .__.; -__-;
think0 /._.
think1 @_@
wave0 ^_^/
wave1 ^__^/
yes0 ^y^
yes1 ^Y^

Metadata

Here is a comprehensive list of metadata items supported by the Chatscript parser.

  • enters (john enters) The creature with an id of john fades into the scene.
  • exits (john exits) The creature with an id of john fades out of the scene.
  • faces (john faces right) The creature with an id of 'john' turns to face right. Supported directions include left, right, se, sw, nw and ne
  • link_if (link_if chat_finished chat/boatricia/hi) The preceding dialog choice is only available if the condition is met.
  • mood (john mood ^O^) The creature with an id of john changes their mood.
  • next_scene (next_scene chat/boatricia/hi) Schedule another cutscene to play immediately after this cutscene.
  • say_if (say_if chat_finished chat/boatricia/hi) The preceding line is only spoken if the condition is met.
  • start_if (start_if chat_finished chat/boatricia/hi) The scene will start with this branch if the condition is met. If a scene has multiple start_if conditions, they should be mutually exclusive.
  • start_walking Makes stopped creatures continue walking during prologue/epilogue scenes.
  • stop_walking Makes creatures stop walking during prologue/epilogue scenes.

Clone this wiki locally