Skip to content

Commit

Permalink
Refactors function names to PascalCase
Browse files Browse the repository at this point in the history
  • Loading branch information
JujuAdams committed Feb 14, 2021
1 parent 7ef2607 commit f46ae52
Show file tree
Hide file tree
Showing 145 changed files with 802 additions and 804 deletions.
62 changes: 30 additions & 32 deletions chatterbox.yyp

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion datafiles/Yarn/Test.yarn
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ Standard choice syntax test.
[[Choice 1|Node3]]
[[Choice 2|Node4]]

<<if if if if if if if>>
//<<if if if if if if if>>

===
title: Node3
Expand Down
2 changes: 1 addition & 1 deletion datafiles/Yarn/Test2.yarn
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ Standard choice syntax test.
[[Choice 1|Node3]]
[[Choice 2|Node4]]

<<if if if if if if if>>
//<<if if if if if if if>>

===
title: Node3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,11 @@ Chatterbox has the following native actions:
<<stop>>
<<wait>>

Custom actions can be added to Chatterbox by using the chatterbox_add_function() script. Custom actions should be added before
calling chatterbox_create().
Custom actions can be added to Chatterbox by using the ChatterboxAddFunction() script. Custom actions should be added before
calling ChatterboxCreate().

GML: chatterbox_load("example.json");
chatterbox_add_function("playMusic", play_background_music);
GML: ChatterboxLoadFromFile("example.json");
ChatterboxAddFunction("playMusic", play_background_music);

Yarn: Here's some text!
<<playMusic>>
Expand All @@ -125,8 +125,8 @@ whenever <<playMusic>> is processed by Chatterbox.
Custom actions can also have parameters. These parameters can be any Chatterbox value - a real number, a string, or a variable.
Parameters should separated by spaces. Parameters are passed into a script as an array of values in argument0.

GML: chatterbox_load("example.json");
chatterbox_add_function("gotoRoom", go_to_room);
GML: ChatterboxLoadFromFile("example.json");
ChatterboxAddFunction("gotoRoom", go_to_room);

Yarn: Let's go see what the priest is up to.
<<gotoRoom "rChapel" $entrance>>
Expand Down Expand Up @@ -205,15 +205,15 @@ By default, Chatterbox includes a visited() function, used to check whether a no
We have gone to the city before!
<<endif>>

Other custom functions can be added to Chatterbox using the chatterbox_add_function() script.
Other custom functions can be added to Chatterbox using the ChatterboxAddFunction() script.
Much like custom actions, custom functions can have parameters. Custom functions should be defined
before calling chatterbox_create().
before calling ChatterboxCreate().

Parameters should be separated by spaces and are passed into a script as an array of values in argument0.
Custom functions can return values, but they should be reals or strings.

GML: chatterbox_load("example.json");
chatterbox_add_function("AmIDead", am_i_dead);
GML: ChatterboxLoadFromFile("example.json");
ChatterboxAddFunction("AmIDead", am_i_dead);

Yarn: Am I dead?
<<if AmIDead("player")>>
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions objects/obj_test/Create_0.gml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
//Load in some source files
chatterbox_load_from_file("Test.yarn");
chatterbox_load_from_file("Test2.yarn");
ChatterboxLoadFromFile("Test.yarn");
ChatterboxLoadFromFile("Test2.yarn");

chatterbox_add_function("TestFunctionDoNotExecute", function(_array) { show_message(_array); });
ChatterboxAddFunction("TestFunctionDoNotExecute", function(_array) { show_message(_array); });

//Create a chatterbox
box = chatterbox_create("Test.yarn");
box = ChatterboxCreate("Test.yarn");

//Tell the chatterbox to jump to a node
chatterbox_goto(box, "Start");
ChatterboxGoto(box, "Start");
12 changes: 6 additions & 6 deletions objects/obj_test/Draw_0.gml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ draw_set_font(fnt_default);
var _x = 10;
var _y = 10;

if (chatterbox_is_stopped(box))
if (ChatterboxIsStopped(box))
{
//If we're stopped then show that
draw_text(_x, _y, "(Chatterbox stopped)");
Expand All @@ -13,17 +13,17 @@ else
{
//All the spoken text
var _i = 0;
repeat(chatterbox_get_content_count(box))
repeat(ChatterboxGetContentCount(box))
{
draw_text(_x, _y, chatterbox_get_content(box, _i));
draw_text(_x, _y, ChatterboxGetContent(box, _i));
_y += 20;
++_i;
}

//Bit of spacing...
_y += 20;

if (chatterbox_is_waiting(box))
if (ChatterboxIsWaiting(box))
{
//If we're in a "waiting" state then prompt the user for basic input
draw_text(_x, _y, "(Press Space)");
Expand All @@ -32,9 +32,9 @@ else
{
//All the options
var _i = 0;
repeat(chatterbox_get_option_count(box))
repeat(ChatterboxGetOptionCount(box))
{
draw_text(_x, _y, string(_i+1) + ") " + chatterbox_get_option(box, _i));
draw_text(_x, _y, string(_i+1) + ") " + ChatterboxGetOption(box, _i));
_y += 20;
++_i;
}
Expand Down
10 changes: 5 additions & 5 deletions objects/obj_test/Step_0.gml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
if (chatterbox_is_stopped(box))
if (ChatterboxIsStopped(box))
{
//If we're stopped then don't respond to user input
}
else if (chatterbox_is_waiting(box))
else if (ChatterboxIsWaiting(box))
{
//If we're in a "waiting" state then let the user press <space> to advance dialogue
if (keyboard_check_released(vk_space))
{
chatterbox_continue(box);
ChatterboxContinue(box);
}
else if (keyboard_check_pressed(ord("F")))
{
//The user can also press F to fast forward through text until they hit a choice
chatterbox_fast_forward(box);
ChatterboxFastForward(box);
}
}
else
Expand All @@ -27,5 +27,5 @@ else
if (keyboard_check_released(ord("4"))) _index = 3;

//If we've pressed a button, select that option
if (_index != undefined) chatterbox_select(box, _index);
if (_index != undefined) ChatterboxSelect(box, _index);
}
6 changes: 3 additions & 3 deletions objects/obj_testcase_action/Create_0.gml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
chatterbox_load_from_file("testcase_action.yarn");
ChatterboxLoadFromFile("testcase_action.yarn");
//Note that <<testcaseAction>> is added as a Chatterbox function in testcase_action_function()
box = chatterbox_create();
chatterbox_goto(box, "Start");
box = ChatterboxCreate();
ChatterboxGoto(box, "Start");
12 changes: 6 additions & 6 deletions objects/obj_testcase_action/Draw_0.gml
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
var _x = 10;
var _y = 10;

if (chatterbox_is_stopped(box))
if (ChatterboxIsStopped(box))
{
draw_text(_x, _y, "(Chatterbox stopped)");
}
else
{
var _i = 0;
repeat(chatterbox_get_content_count(box))
repeat(ChatterboxGetContentCount(box))
{
draw_text(_x, _y, chatterbox_get_content(box, _i));
draw_text(_x, _y, ChatterboxGetContent(box, _i));
_y += 20;
++_i;
}

_y += 20;

if (chatterbox_is_waiting(box))
if (ChatterboxIsWaiting(box))
{
draw_text(_x, _y, "(Press Space)");
}
else
{
var _i = 0;
repeat(chatterbox_get_option_count(box))
repeat(ChatterboxGetOptionCount(box))
{
draw_text(_x, _y, string(_i+1) + ") " + chatterbox_get_option(box, _i));
draw_text(_x, _y, string(_i+1) + ") " + ChatterboxGetOption(box, _i));
_y += 20;
++_i;
}
Expand Down
6 changes: 3 additions & 3 deletions objects/obj_testcase_action/Step_0.gml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
if (chatterbox_is_waiting(box))
if (ChatterboxIsWaiting(box))
{
if (keyboard_check_released(vk_space)) chatterbox_continue(box);
if (keyboard_check_released(vk_space)) ChatterboxContinue(box);
}
else
{
Expand All @@ -9,5 +9,5 @@ else
if (keyboard_check_released(ord("2"))) _index = 1;
if (keyboard_check_released(ord("3"))) _index = 2;
if (keyboard_check_released(ord("4"))) _index = 3;
if (_index != undefined) chatterbox_select(box, _index);
if (_index != undefined) ChatterboxSelect(box, _index);
}
6 changes: 3 additions & 3 deletions objects/obj_testcase_bom/Create_0.gml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
chatterbox_load_from_file("testcase_bom.yarn");
box = chatterbox_create();
chatterbox_goto(box, "Start");
ChatterboxLoadFromFile("testcase_bom.yarn");
box = ChatterboxCreate();
ChatterboxGoto(box, "Start");
12 changes: 6 additions & 6 deletions objects/obj_testcase_bom/Draw_0.gml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ draw_set_font(fnt_default);
var _x = 10;
var _y = 10;

if (chatterbox_is_stopped(box))
if (ChatterboxIsStopped(box))
{
//If we're stopped then show that
draw_text(_x, _y, "(Chatterbox stopped)");
Expand All @@ -13,17 +13,17 @@ else
{
//All the spoken text
var _i = 0;
repeat(chatterbox_get_content_count(box))
repeat(ChatterboxGetContentCount(box))
{
draw_text(_x, _y, chatterbox_get_content(box, _i));
draw_text(_x, _y, ChatterboxGetContent(box, _i));
_y += 20;
++_i;
}

//Bit of spacing...
_y += 20;

if (chatterbox_is_waiting(box))
if (ChatterboxIsWaiting(box))
{
//If we're in a "waiting" state then prompt the user for basic input
draw_text(_x, _y, "(Press Space)");
Expand All @@ -32,9 +32,9 @@ else
{
//All the options
var _i = 0;
repeat(chatterbox_get_option_count(box))
repeat(ChatterboxGetOptionCount(box))
{
draw_text(_x, _y, string(_i+1) + ") " + chatterbox_get_option(box, _i));
draw_text(_x, _y, string(_i+1) + ") " + ChatterboxGetOption(box, _i));
_y += 20;
++_i;
}
Expand Down
Loading

0 comments on commit f46ae52

Please sign in to comment.