Undertale Yellow script viewer

← back to main script listing

gml_Object_obj_dalv_diary_Step_0

(view raw script w/o annotations or w/e)
1
if ((keyboard_multicheck_pressed(0) && scr_interact
scr_interact

function scr_interact() { if (distance_to_object(obj_pl) < 20 && obj_pl.state == scr_normal_state) { var pl_dir = obj_pl.direction; var pl_x = 0; var pl_y = 0; var check_distance_x = 0; var check_distance_y = 0; switch (pl_dir) { case 0: pl_x = obj_pl.bbox_right; pl_y = obj_pl.bbox_top + 1; check_distance_x = 20; break; case 180: pl_x = obj_pl.bbox_left; pl_y = obj_pl.bbox_top + 1; check_distance_x = -20; break; case 90: pl_x = obj_pl.x; pl_y = obj_pl.bbox_top; check_distance_y = -20; break; case 270: pl_x = obj_pl.x; pl_y = obj_pl.bbox_bottom; check_distance_y = 20; break; } if (collision_line_first(pl_x, pl_y, pl_x + check_distance_x, pl_y + check_distance_y, id, false, false)) return true; } }
() == true) && waiter == 0)
2
    waiter = 1;
3
var diary_music = 135;
4
if (waiter == 1)
5
{
6
    scr_cutscene_start
scr_cutscene_start

function scr_cutscene_start() { global.cutscene = true; obj_pl.state = scr_frozen_state; obj_pl.image_index = 0; obj_pl.image_speed = 0; }
();
7
    scr_text
scr_text

function scr_text() { if (!instance_exists(obj_dialogue)) msg = instance_create(x, y, obj_dialogue); }
();
8
    with (msg)
9
    {
10
        ch_msg = 2;
11
        ch[1] = "Yes";
12
        ch[2] = "No";
13
        portrait = false;
14
        sndfnt = 99;
15
        if (other.npc_flag == 0)
16
        {
17
            message[0] = "* (It looks like Dalv's diary.)";
18
            message[1] = "* (This could contain private#  information.)";
19
            message[2] = "* (Read it?)";
20
        }
21
        else
22
        {
23
            if (message_current == 0)
24
                message_current = 1;
25
            message[1] = "* (It's Dalv's diary.)";
26
            message[2] = "* (Read it?)";
27
        }
28
        if (outcome == 1)
29
        {
30
            message[3] = "* (You open the diary up.)";
31
            message[4] = "* (There's only one entry. It#  seems new.)";
32
            other.waiter = 2;
33
            other.timer = 30;
34
        }
35
        else if (outcome == 2)
36
        {
37
            other.waiter = 5;
38
            instance_destroy();
39
        }
40
    }
41
}
42
if (waiter == 2 && !global.dialogue_open)
43
{
44
    if (scr_timer
scr_timer

function scr_timer() { if (timer > 0) { timer--; return false; } else { return true; } }
())
45
    {
46
        if (audio_is_playing(mus_dalventertainer))
47
        {
48
            audio_sound_gain(mus_dalventertainer, 0, 500);
49
            var audio_gain = audio_sound_get_gain(mus_dalventertainer);
50
            if (audio_gain == 0)
51
                audio_stop_sound(mus_dalventertainer);
52
        }
53
        else
54
        {
55
            waiter++;
56
        }
57
    }
58
}
59
if (waiter == 3)
60
{
61
    scr_text
scr_text

function scr_text() { if (!instance_exists(obj_dialogue)) msg = instance_create(x, y, obj_dialogue); }
();
62
    with (msg)
63
    {
64
        sndfnt = 100;
65
        portrait = false;
66
        message[0] = "* Today began like every other#  day.";
67
        message[1] = "* I got out of bed, brushed my#  fangs, and had a nice bowl of#  corn for breakfast.";
68
        message[2] = "* Pops made a very funny joke at#  Broom's expense and we all had#  a laugh.";
69
        message[3] = "* I put on my cloak and went out#  for my daily walk.";
70
        message[4] = "* I noticed another blue corn had#  popped up in your cornfield#  today.";
71
        message[5] = "* I always feel bad for#  discarding the special corn but#  I can't risk getting sick.";
72
        message[6] = "* Anyways...";
73
        message[7] = "* Something interesting happened#  a bit later.";
74
        message[8] = "* I overheard Flier and Penilla#  talking about me...";
75
        message[9] = "* About us...";
76
        message[10] = "* They said they were concerned#  for me.";
77
        message[11] = "* They said I talk to myself.";
78
        message[12] = "* ...";
79
        message[13] = "* Penilla then chimed in and#  commented on my advice and#  gifts to you.";
80
        message[14] = "* My signs.";
81
        message[15] = "* They said you don't exist...";
82
        message[16] = "* That isn't true.";
83
        message[17] = "* You do.";
84
        message[18] = "* I know you do.";
85
        message[19] = "* You reached out to me when I#  needed it most.";
86
        message[20] = "* ...Helped me cope with the#  past...";
87
        message[21] = "* How could they be so mean?";
88
        message[22] = "* What do they know?";
89
        message[23] = "* I don't need them.";
90
        message[24] = "* Because...";
91
        message[25] = "* Because I have you.";
92
        message[26] = "* ...";
93
        message[27] = "* It's been one year.";
94
        message[28] = "* ...";
95
        message[29] = "* I'm still waiting.";
96
    }
97
    if (!global.dialogue_open)
98
    {
99
        waiter = 4;
100
        timer = 30;
101
    }
102
}
103
if (waiter == 4)
104
{
105
    if (!scr_timer
scr_timer

function scr_timer() { if (timer > 0) { timer--; return false; } else { return true; } }
())
106
        exit;
107
    scr_text
scr_text

function scr_text() { if (!instance_exists(obj_dialogue)) msg = instance_create(x, y, obj_dialogue); }
();
108
    with (msg)
109
    {
110
        sndfnt = 99;
111
        portrait = false;
112
        message[0] = "* (The entry ends there.)";
113
    }
114
    if (!global.dialogue_open)
115
        waiter = 5;
116
}
117
if (waiter == 5)
118
{
119
    if (audio_is_playing(diary_music))
120
        audio_stop_sound(diary_music);
121
    if (npc_flag == 0)
122
        npc_flag = 1;
123
    waiter = 0;
124
    scr_cutscene_end
scr_cutscene_end

function scr_cutscene_end() { global.cutscene = false; obj_pl.alarm[0] = 1; }
();
125
}
126
if (ds_map_find_value(global.npc_map, npc_id) != npc_flag)
127
    ds_map_replace(global.npc_map, npc_id, npc_flag);