Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
JujuAdams committed Aug 2, 2020
2 parents 559a075 + 9a7c030 commit a948bdb
Show file tree
Hide file tree
Showing 43 changed files with 416 additions and 98 deletions.
39 changes: 28 additions & 11 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.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{
"title": "Start",
"tags": "",
"body": "Frank: Hey, it's me. Frank.\nSammy: W-who?\nFrank: Frank! Ya know?\n<<set c = 2>> \nSammy: Umm. N-no, I don't... know?\n<<if c == 3>>\n <<set d = 4>>\n<<endif>>\n[[Why don't you know?|WhyNot]]\n[[Anyways, whatever.|Whatever]]\n[[Test New Options|TestNewOptions]]",
"body": "Frank: Hey, it's me. Frank.\nSammy: W-who?\nFrank: Frank! Ya know?\n<<set c = 2>> \n<<if c == 3>>\n <<set d = 4>>\n<<endif>>\nSammy: Umm. N-no, I don't... know?\n[[Why don't you know?|WhyNot]]\n[[Anyways, whatever.|Whatever]]\n[[Test New Options|TestNewOptions]]",
"position": {
"x": 672,
"y": 285
Expand Down
2 changes: 1 addition & 1 deletion notes/__chatterbox_syntax/__chatterbox_syntax.txt
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ This statement serves to set a variable's value. No declarative statement is req
Variables in Chatterbox can have their scope controlled by using prefixes:

<<set global.meaning to 42>> This will set the GM global variable "global.meaning" to the value 42.
<<set local.variable to 13>> This will set the GM instance variable "shenanigans" to the value 13.
<<set local.shenanigans to 13>> This will set the GM instance variable "shenanigans" to the value 13.
<<set internal.organelle to 7>> This will set the internal Chatterbox variable "organelle" to the value 7.

Internal Chatterbox variables are, in reality, key:value pairs stored in a global ds_map. You can access this ds_map via
Expand Down
46 changes: 31 additions & 15 deletions objects/obj_test/Draw_0.gml
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,39 @@
var _x = 10;
var _y = 10;

//All the spoken text
var _i = 0;
repeat(array_length(box.content))
if (chatterbox_is_stopped(box))
{
draw_text(_x, _y, box.content[_i]);
_y += 20;
++_i;
//If we're stopped then show that
draw_text(_x, _y, "(Chatterbox stopped)");
}

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

//All the options
var _i = 0;
repeat(array_length(box.option))
else
{
draw_text(_x, _y, string(_i+1) + ") " + string(box.option[_i]));
//All the spoken text
var _i = 0;
repeat(chatterbox_get_content_count(box))
{
draw_text(_x, _y, chatterbox_get_content(box, _i));
_y += 20;
++_i;
}

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

if (chatterbox_is_waiting(box))
{
//If we're in a "waiting" state then prompt the user for basic input
draw_text(_x, _y, "(Press Space)");
}
else
{
//All the options
var _i = 0;
repeat(chatterbox_get_option_count(box))
{
draw_text(_x, _y, string(_i+1) + ") " + chatterbox_get_option(box, _i));
_y += 20;
++_i;
}
}
}
35 changes: 26 additions & 9 deletions objects/obj_test/Step_0.gml
Original file line number Diff line number Diff line change
@@ -1,9 +1,26 @@
//Check for any keyboard input
var _index = undefined;
if (keyboard_check_released(ord("1"))) _index = 0;
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 we've pressed a button, select that option
if (_index != undefined) chatterbox_select(box, _index);
if (chatterbox_is_stopped(box))
{
//If we're stopped then don't respond to user input
}
else if (chatterbox_is_waiting(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);
}
}
else
{
//If we're not waiting then we have some options!

//Check for any keyboard input
var _index = undefined;
if (keyboard_check_released(ord("1"))) _index = 0;
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 we've pressed a button, select that option
if (_index != undefined) chatterbox_select(box, _index);
}
2 changes: 1 addition & 1 deletion objects/obj_testcase_action/Create_0.gml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
chatterbox_load("testcase_action.yarn");
chatterbox_add_function("testcaseAction", testcase_action_function);
//Note that <<testcaseAction>> is added as a Chatterbox function in testcase_action_function()
box = chatterbox_create();
chatterbox_goto(box, "Start");
38 changes: 26 additions & 12 deletions objects/obj_testcase_action/Draw_0.gml
Original file line number Diff line number Diff line change
@@ -1,20 +1,34 @@
var _x = 10;
var _y = 10;

var _i = 0;
repeat(array_length(box.content))
if (chatterbox_is_stopped(box))
{
draw_text(_x, _y, box.content[_i]);
_y += 20;
++_i;
draw_text(_x, _y, "(Chatterbox stopped)");
}

_y += 20;

var _i = 0;
repeat(array_length(box.option))
else
{
draw_text(_x, _y, string(_i+1) + ") " + string(box.option[_i]));
var _i = 0;
repeat(chatterbox_get_content_count(box))
{
draw_text(_x, _y, chatterbox_get_content(box, _i));
_y += 20;
++_i;
}

_y += 20;
++_i;

if (chatterbox_is_waiting(box))
{
draw_text(_x, _y, "(Press Space)");
}
else
{
var _i = 0;
repeat(chatterbox_get_option_count(box))
{
draw_text(_x, _y, string(_i+1) + ") " + chatterbox_get_option(box, _i));
_y += 20;
++_i;
}
}
}
19 changes: 13 additions & 6 deletions objects/obj_testcase_action/Step_0.gml
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
var _index = undefined;
if (keyboard_check_released(ord("1"))) _index = 0;
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 (chatterbox_is_waiting(box))
{
if (keyboard_check_released(vk_space)) chatterbox_continue(box);
}
else
{
var _index = undefined;
if (keyboard_check_released(ord("1"))) _index = 0;
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);
}
38 changes: 26 additions & 12 deletions objects/obj_testcase_option/Draw_0.gml
Original file line number Diff line number Diff line change
@@ -1,20 +1,34 @@
var _x = 10;
var _y = 10;

var _i = 0;
repeat(array_length(box.content))
if (chatterbox_is_stopped(box))
{
draw_text(_x, _y, box.content[_i]);
_y += 20;
++_i;
draw_text(_x, _y, "(Chatterbox stopped)");
}

_y += 20;

var _i = 0;
repeat(array_length(box.option))
else
{
draw_text(_x, _y, string(_i+1) + ") " + string(box.option[_i]));
var _i = 0;
repeat(chatterbox_get_content_count(box))
{
draw_text(_x, _y, chatterbox_get_content(box, _i));
_y += 20;
++_i;
}

_y += 20;
++_i;

if (chatterbox_is_waiting(box))
{
draw_text(_x, _y, "(Press Space)");
}
else
{
var _i = 0;
repeat(chatterbox_get_option_count(box))
{
draw_text(_x, _y, string(_i+1) + ") " + chatterbox_get_option(box, _i));
_y += 20;
++_i;
}
}
}
19 changes: 13 additions & 6 deletions objects/obj_testcase_option/Step_0.gml
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
var _index = undefined;
if (keyboard_check_released(ord("1"))) _index = 0;
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 (chatterbox_is_waiting(box))
{
if (keyboard_check_released(vk_space)) chatterbox_continue(box);
}
else
{
var _index = undefined;
if (keyboard_check_released(ord("1"))) _index = 0;
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);
}
2 changes: 1 addition & 1 deletion options/windows/options_windows.yy

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

1 change: 0 additions & 1 deletion scripts/__chatterbox_config/__chatterbox_config.gml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#macro CHATTERBOX_VARIABLES_MAP global.chatterbox_variables_map
#macro CHATTERBOX_SOURCE_DIRECTORY "Yarn"
#macro CHATTERBOX_DEFAULT_SINGLETON true
#macro CHATTERBOX_WAIT_OPTION_TEXT "<<wait>>"
#macro CHATTERBOX_ALLOW_SCRIPTS true

#region Variables and Scoping
Expand Down
8 changes: 4 additions & 4 deletions scripts/__chatterbox_system/__chatterbox_system.gml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#region Internal Macro Definitions

#macro __CHATTERBOX_VERSION "0.3.7"
#macro __CHATTERBOX_DATE "2020/07/30"
#macro __CHATTERBOX_VERSION "0.4.0"
#macro __CHATTERBOX_DATE "2020/08/02"

#macro __CHATTERBOX_VARIABLE_INVALID "__chatterbox_variable_error"

Expand Down Expand Up @@ -30,10 +30,10 @@ global.__chatterbox_default_file = "";
global.__chatterbox_indent_size = 0;
global.__chatterbox_scope = undefined;
global.__chatterbox_variable_name = __CHATTERBOX_VARIABLE_INVALID;
global.__chatterbox_functions = ds_map_create();
global.__chatterbox_findreplace_old_string = ds_list_create();
global.__chatterbox_findreplace_new_string = ds_list_create();

if (!variable_global_exists("__chatterbox_functions")) global.__chatterbox_functions = ds_map_create();

//Big ol' list of operator dipthongs
global.__chatterbox_op_list = ds_list_create();
global.__chatterbox_op_list[| 0] = "(";
Expand Down
Loading

0 comments on commit a948bdb

Please sign in to comment.