Chatscript - Poobslag/turbofat GitHub Wiki
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.
{"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. -
advance_region
: If true, the player is automatically advanced to the next region in career mode. This is a thematic consideration for cutscenes which show the player running to a new area. -
fixed_zoom
: For cutscenes with moving characters or where background details are important, thefixed_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]
outdoors
This section defines the location for a cutscene. See the full list of locations in the table below.
[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)
,(customer)
or(observer)
. This metadata ensures cutscenes are paired with appropriate levels. Chefs and customers appear during levels. Observers only appear on the map screen and during cutscenes but not during levels. Thematically, observers represent people like health inspectors or teachers who don't actually cook or eat food. -
<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.
- If preceded with
Every chatscript file contains a dialog section which defines the conversation's text, moods and branches.
p1: Well that was... good!
b: <_< Just good?
The dialog section begins with the default dialog branch, which does not have a header.
<speaker>: <mood> <text>
-
<speaker>
: The alias or creature ID of the creature speaking the line. The special aliasesplayer
andsensei
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.
(<text>)
-
<text>
: The text being showed to the player. This might be something they're thinking, or something happening which we can't show.
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.
[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.
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.
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.
This location table is generated by chatscript-table-demo.gd.
location | description |
---|---|
filming | Generic Turbo Fat restaurant interior with cameras |
inside_turbo_fat | Generic Turbo Fat restaurant interior |
lava | "Chocolava Canyon" environment |
lava/gift_shop | "Chocolava Canyon" Zagma HQ gift shop |
lava/zagma | "Chocolava Canyon" Zagma HQ interior |
lemon | "Lemony Thickets" environment |
lemon/walk | "Lemony Thickets" walking environment |
lemon_2 | "Welcome To Turbo Fat" environment |
marsh | "Merrymellow Marsh" environment |
marsh/walk | "Merrymellow Marsh" walking environment |
poki | "Poki Desert" environment |
poki/walk | "Poki Desert" walking environment |
sand | "Cannoli Sandbar" environment |
sand/banana_hq | "Cannoli Sandbar" Banana HQ interior |
sand/walk | "Cannoli Sandbar" walking environment |
This mood table is generated by chatscript-table-demo.gd.
Some moods have synonyms like <_<
and >_>
. These are interchangeable, there is no difference.
Most moods have varying intensities. cry1
for example is a more intense version of cry0
.
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 | -__- |
||
sly0 | -u- |
||
sly1 | -o- |
||
smile0 | ^_^ |
||
smile1 | ^__^ |
||
sweat0 | ._.; |
-_-; |
|
sweat1 | .__.; |
-__-; |
|
think0 | /._. |
||
think1 | @_@ |
||
wave0 | ._./ |
||
wave1 | ^_^/ |
||
wave2 | ^__^/ |
||
yes0 | ^y^ |
||
yes1 | ^Y^ |
Here is a comprehensive list of metadata items supported by the Chatscript parser.
-
default_phrase
(default_phrase bad_restaurant_name Junjorito)
Sets thebad_restaurant_name
phrase toJunjorito
if it is not already set. This is useful to avoid the player seeing#bad_restaurant_name#
if they somehow sequence broke to a later part of the game. -
enters
(john enters)
The creature with an id ofjohn
fades into the scene. -
exits
(john exits)
The creature with an id ofjohn
fades out of the scene. -
faces
(john faces right)
The creature with an id of 'john' turns to face right. Supported directions includeleft
,right
,se
,sw
,nw
andne
-
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 ofjohn
changes their mood. -
nametag_text
(nametag_text Mysterious Stranger)
Override the speaker's name with the specified text. -
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. -
set_flag Sets a flag. Flags store player choices so that later cutscenes can branch based on decisions from earlier cutscenes.
-
(set_flag foo)
Sets the 'foo' flag to 'true'. -
(set_flag foo bar)
Sets the 'foo' flag to 'bar'.
-
-
set_phrase
(set_phrase bad_restaurant_name Junjorito)
Sets thebad_restaurant_name
phrase toJunjorito
. Phrases store responses which can be injected in later cutscenes:Remember when you wanted to name our restaurant #bad_restaurant_name#?
-
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 multiplestart_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.
-
unset_flag
unset_flag foo
Unsets the 'foo' flag. Flags store player choices so that later cutscenes can branch based on decisions from earlier cutscenes. -
unset_phrase
unset_phrase foo
Unsets the 'foo' phrase. Phrases store responses which can be injected in later cutscenes.
Here is a comprehensive list of boolean conditions supported by the chatscript parser.
-
chat_finished
chat_finished marsh/20_end
True if the player has seen themarsh/20_end
cutscene. -
has_flag
has_flag dirty_kitchen
True if thedirty_kitchen
flag was set using aset_flag
statement. -
has_phrase
has_phrase restaurant_name
True if therestaurant_name
phrase was set to a non-empty value using aset_phrase
statement. -
is_flag
is_flag sensei_gender female
True if thesensei_gender
flag was set tofemale
using aset_flag
statement. -
level_finished
level_finished career/one_step_ahead
True if the player has cleared thecareer/one_step_ahead
level.
The chatscript parser also accepts and, false, not, or, true, ( and )
All chatscript files must be kebab case, like intro-level.chat
.
Chatscript filenames in career mode follow a naming convention, which causes them to play in a specific order.
-
prologue.chat
: Plays before any other cutscenes or levels -
intro-level.chat
: Plays before the intro level -
intro-level-end.chat
: Plays after the intro level -
010-b.chat
,100-end.chat
: An interlude which plays before or after a puzzle in career mode. The name has several parts:-
010-...
: Numeric siblings are always played in ascending order (000, 010, 011, 020...). Nodes starting with a number 100-199 are post-boss cutscenes, and will not play unless the player has cleared the region's boss level. Nodes starting with a number 200-299 are post-epilogue cutscenes, and the epilogue will play before them (if an epilogue exists.) -
...-b-...
: Alphabetic siblings are played in random order (c, a, b...). -
-end...
: The suffix 'end' indicates that the cutscene plays after a puzzle. If the suffix is not present, the cutscene will play before a puzzle.
-
-
boss-level.chat
: Plays before the boss level. -
boss-level-end.chat
: Plays after the boss level. -
epilogue.chat
: Plays after all other cutscenes/levels.
If multiple cutscenes should be played consecutively, the next_scene
metadata item can queue them up. These scenes follow the convention <name>.chat
, <name>-2.chat
, <name>-3.chat
...