<undefined>
0
-1
-1000000003
-1
<undefined>
<undefined>
1
603
7
0
0
-1
2
self
0
0
1
///Initialize dialog when created
dialog_init();
inikey = "";
1
603
7
0
0
-1
2
self
0
0
1
///Say the room start dialog after objects have been drawn
switch(room) {
default: break;
}
1
603
7
0
0
-1
2
self
0
0
1
///Deal with questions
//Dealing with input is done in End Step after the instances have been activated,
//allowing other instances to be affected.
if(currentOption != -1 && dialog_count() == 1) {
//If you do not want to ask for confirmation uncomment the following:
//diaPos = string_length(dialog_get());
//Also, remove both the 'diaPos = 0;' lines from below and do the
//necessary changes to the dialog_draw() event
//Change options with up/down. Loop if gone past the last one
if(keyboard_check_pressed(vk_down)) {
diaPos = 0; //Set diaPos to 0 to make the user confirm after changing option
currentOption = (currentOption + 1) % optionCount;
} else if(keyboard_check_pressed(vk_up)) {
diaPos = 0;
currentOption = ((currentOption - 1) + optionCount) % optionCount;
}
} else if(!dialog_count() && currentOption != -1) {
/* If you prefer, you can figure out what the question was in other ways too.
This is, in my opinion, the simplest way. If you find an easier one please
tell me.*/
//Save the question
var question = questionAsked, answer = currentOption;
//Clear values. Must be done before handling in case you want to ask another question
questionAsked = "";
currentOption = -1;
switch(question) {
default: //Give a failure message to make debugging easier
dialog_msg("Question not found", "ERROR", noone, noone);
break;
}
}
1
603
7
0
0
-1
2
self
0
0
1
///Deal with string input
if(is_string(inputValue) && dialog_count() == 1) {
//Change the input value
//Uncomment the next line if you don't want a confirm
//diaPos = 1;
//Also remove the 'diaPos = 0;' line from below
if(inputValue != keyboard_string) {
inputValue = keyboard_string;
diaPos = 0; //Reset diaPos if the string has changed to make the player confirm again
}
} else if(is_string(inputValue) && !dialog_count()) {
/* This works essentially the same as with options.
Feel free to change the method of determining the question here too. */
//Save question and answer
var question = questionAsked, answer = inputValue;
//Clear input values
questionAsked = "";
inputValue = 0;
keyboard_string = "";
switch(question) {
case "What is your name?":
if(answer != "" && answer == string_lettersdigits(answer)) {
dialog_var("PLAYERNAME", answer);
with(StoryController) {
dialog_from_array(4, 8);
progress[0] = 3;
}
} else {
with(StoryController) {
dialog_from_array(3);
}
}
break;
default:
dialog_msg("Question not found", "ERROR", noone, noone);
break;
}
}
1
603
7
0
0
-1
2
self
0
0
1
///Actions on regular messages
if(!dialog_count()) {
//Similar to questions, but without answers.
if(lastMessage != "") {
var same = lastMessage;
switch(lastMessage) {
case "AHA!":
with(Brad) {
hdist = 32;
}
with(Player) {
facing = LEFT;
}
break;
case "Good luck,"+WAIT+" I'll be in your house if you need me.":
with(Brad) {
hdist = 32;
}
with(Player) {
hdist = 32;
}
StoryController.progress[0] = 4;
break;
case "I've been so worried for it."+WAIT+"."+WAIT+"."+WAIT+WAIT+" The poor thing has no way of defending itself."+WAIT+WAIT+" Please save him!":
StoryController.state[1] = 1;
break;
case "She looks pretty happy."+WAIT+"."+WAIT+"."+WAIT+WAIT+" Best get out of here while I can.":
StoryController.state[1] = 3;
inv_subtract(inv_has("Stuffed Cat"), 1);
break;
case "."+WAIT+"."+WAIT+"."+WAIT+WAIT+" No."+WAIT+WAIT+" I'm too sad for that."+WAIT+WAIT+" Could you go get them for me?"+WAIT+WAIT+" There are 4."+WAIT+"."+WAIT+".":
StoryController.state[2] = 1;
break;
case "That's all of them!"+WAIT+WAIT+" Thank you!"+WAIT+WAIT+" I wonder what I put inside."+WAIT+"."+WAIT+".":
Spirit1.vdist = -32;
StoryController.state[2] = 3;
StoryController.cutscene = true;
break;
case "You'll need something really long."+WAIT+WAIT+" Like a bridge!":
StoryController.state[3] = 1;
break;
case "I got a "+COL+"iLadder"+COL+"d. I'll lay it across here,"+WAIT+" then you can climb across.":
with(Player) {
hdist = 32;
vdist = 0;
}
with(StoryController) {
state[3] = 3;
cutscene = true;
}
break;
case "Well then you had better bring me some real food!":
StoryController.state[4] = 1;
break;
case "*Munch munch* Ahh."+WAIT+"."+WAIT+"."+WAIT+WAIT+" Thank you very much,"+WAIT+" mister!":
StoryController.state[4] = 3;
inv_subtract(inv_has("Fish"), 1);
break;
case "But it has to have a face!":
StoryController.state[5] = 1;
break;
case "Thank you very much mister!":
StoryController.state[5] = 3;
inv_subtract(inv_has("Flower"), 1);
break;
case "Please,"+WAIT+" you have to get me out of here before the spider gets back!":
StoryController.state[6] = 1;
break;
case "Yes use that "+COL+"iStick"+COL+"d and break me out of here!":
with(Web) instance_destroy();
StoryController.state[6] = 3;
break;
case "The web stuck to the "+COL+"iStick"+COL+"d. You got a "+COL+"iNet"+COL+"d!":
inv_subtract(inv_has("Stick"), 1);
inv_add("Net", 1);
break;
case "Thanks for everything."+WAIT+WAIT+" See you around!":
if(Player.x == Brad.x && Player.y == Brad.y + 32) {
Player.hdist = 32;
}
with(StoryController) {
cutscene = true;
progress[0] = 1;
}
break;
case SIZE+"sMumble mumble mumble."+WAIT+"."+WAIT+"."+WAIT+WAIT+SIZE+"m HA!!!":
tile_layer_delete(100000);
with(StoryController) {
dialog_from_array(2, 4);
progress[0] = 8;
}
break;
case "."+WAIT+"."+WAIT+"."+WAIT+WAIT+" Bye!!":
with(Brad) {
mvspd = 8;
hdist = -(x + 32);
}
StoryController.progress[0] = 9;
break;
//Do nothing by default
default: break;
}
if(lastMessage == same) {
lastMessage = ""; //Clear last message
}
}
}
1
603
7
0
0
-1
2
self
0
0
1
///Update dialog variables
/*
Here all variables that are to be used in strings must be included.
Make sure that the value actually exists before setting it.
These variables can only use letters, numbers and underscores (_),
similar to regular variables.
*/
dialog_var("KEYCOUNT", 4 - (inv_has("Key 1") != -1)
- (inv_has("Key 2") != -1)
- (inv_has("Key 3") != -1)
- (inv_has("Key 4") != -1));
dialog_var("TREESFIXED", (StoryController.state[1] == 3) +
(StoryController.state[2] == 4) +
(StoryController.state[3] == 4) +
(StoryController.state[4] == 3) +
(StoryController.state[5] == 3) +
(StoryController.state[6] == 4));
1
603
7
0
0
-1
2
self
0
0
1
///Go to next message, or skip to the end
if((input_check_pressed(ACTION) && (!is_string(inputValue) || dialog_count() > 1) || keyboard_check_pressed(vk_enter)) && dialog_count()) {
dialog_next();
//Reactivate instances if there are no more messages
//Reactivating them here ensures there is no frame where they aren't drawn
if(!dialog_count()) {
unpause();
}
}
1
603
7
0
0
-1
2
self
0
0
1
///Set alarm for drawing messages
//Do room start messages 1 frame in so that the objects draw once
//If you don't want the sprites to show up until the dialog is finished,
//put the dialog_msg()'s in here.
alarm[0] = 1;
1
603
7
0
0
-1
2
self
0
0
1
///Draw dialog
if(dialog_count()) {
//Pause the game (if not already paused)
if(!sprite_exists(Controller.sPause)) {
pause();
}
//Darken the surroundings if you want to draw attention to the dialog
/*/Remove these 4 lines if you don't
draw_set_alpha(0.2);
draw_set_color(c_black);
draw_rectangle(0, 0, window_get_width(), window_get_height(), false);
draw_set_alpha(1);
/****************************************************/
//Draw the sprites, box, and message on top of sPause
dialog_draw();
}
0
0
0
0.5
0.100000001490116
0
0.100000001490116
0.100000001490116
0.200000002980232
-1
0