-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
- Loading branch information
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
title: Start | ||
--- | ||
<<declare $a = "Tar">> | ||
<<declare $b = "get">> | ||
<<jump ($a + $b)>> | ||
=== | ||
|
||
title: Target | ||
--- | ||
This is the target node. | ||
=== |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,13 @@ | ||
if (CHATTERBOX_DIRECTION_MODE != 0) | ||
{ | ||
__ChatterboxError("CHATTERBOX_DIRECTION_MODE should be 0 for this test"); | ||
} | ||
|
||
if (CHATTERBOX_DIRECTION_FUNCTION != TestCaseDirectionFunction) | ||
{ | ||
__ChatterboxError("CHATTERBOX_DIRECTION_FUNCTION should be TestCaseDirectionFunction for this test"); | ||
} | ||
|
||
ChatterboxLoadFromFile("testcase_direction.yarn"); | ||
box = ChatterboxCreate(); | ||
ChatterboxJump(box, "Start"); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
if (CHATTERBOX_DIRECTION_MODE != 1) | ||
{ | ||
__ChatterboxError("CHATTERBOX_DIRECTION_MODE should be 0 for this test"); | ||
} | ||
|
||
ChatterboxLoadFromFile("testcase_direction_as_expression.yarn"); | ||
box = ChatterboxCreate(); | ||
ChatterboxJump(box, "Start"); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
if (CHATTERBOX_DIRECTION_MODE != 2) | ||
{ | ||
__ChatterboxError("CHATTERBOX_DIRECTION_MODE should be 2 for this test"); | ||
} | ||
|
||
ChatterboxLoadFromFile("testcase_direction_as_weirdo.yarn"); | ||
box = ChatterboxCreate(); | ||
ChatterboxJump(box, "Start"); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
ChatterboxLoadFromFile("testcase_jump_include_variable.yarn"); | ||
box = ChatterboxCreate(); | ||
ChatterboxJump(box, "Start"); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
draw_set_font(fntDefault); | ||
|
||
//Iterate over all text and draw it | ||
var _x = 10; | ||
var _y = 10; | ||
|
||
if (ChatterboxIsStopped(box)) | ||
{ | ||
//If we're stopped then show that | ||
draw_text(_x, _y, "(Chatterbox stopped)"); | ||
} | ||
else | ||
{ | ||
//All the spoken text | ||
var _i = 0; | ||
repeat(ChatterboxGetContentCount(box)) | ||
{ | ||
var _string = ChatterboxGetContent(box, _i); | ||
draw_text(_x, _y, _string); | ||
_y += string_height(_string); | ||
++_i; | ||
} | ||
|
||
//Bit of spacing... | ||
_y += 30; | ||
|
||
if (ChatterboxIsWaiting(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(ChatterboxGetOptionCount(box)) | ||
{ | ||
var _string = ChatterboxGetOption(box, _i); | ||
draw_text(_x, _y, string(_i+1) + ") " + _string); | ||
_y += string_height(_string); | ||
++_i; | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
if (ChatterboxIsStopped(box)) | ||
{ | ||
//If we're stopped then don't respond to user input | ||
} | ||
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)) | ||
{ | ||
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 | ||
ChatterboxFastForward(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) ChatterboxSelect(box, _index); | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/// Returns an array of node titles for the given source | ||
/// | ||
/// @param sourceName | ||
|
||
function ChatterboxSourceGetNodeTitles(_sourceName) | ||
{ | ||
if (!ChatterboxIsLoaded(_sourceName)) | ||
{ | ||
__ChatterboxError("Source file \"", _sourceName, "\" has not been loaded"); | ||
return []; | ||
} | ||
|
||
var _i = 0; | ||
var _array = []; | ||
|
||
repeat (array_length(global.chatterboxFiles[? _sourceName].nodes)) | ||
{ | ||
array_push(_array,global.chatterboxFiles[? _sourceName].nodes[_i].title); | ||
++_i; | ||
} | ||
|
||
return _array; | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.