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() //gml_Script_scr_interact { if (distance_to_object(obj_pl) < 20 && obj_pl.state == gml_Script_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 = mus_dalv_diary
4
if (waiter == 1)
5
{
6
    scr_cutscene_start
scr_cutscene_start

function scr_cutscene_start() //gml_Script_scr_cutscene_start { global.cutscene = true obj_pl.state = gml_Script_scr_frozen_state obj_pl.image_index = 0 obj_pl.image_speed = 0 }
()
7
    scr_text
scr_text

function scr_text() //gml_Script_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() //gml_Script_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
            waiter++
55
    }
56
}
57
if (waiter == 3)
58
{
59
    scr_text
scr_text

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

function scr_timer() //gml_Script_scr_timer { if (timer > 0) { timer-- return false; } else return true; }
())
104
        return;
105
    scr_text
scr_text

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

function scr_cutscene_end() //gml_Script_scr_cutscene_end { global.cutscene = false obj_pl.alarm[0] = 1 }
()
123
}
124
if (ds_map_find_value(global.npc_map, npc_id) != npc_flag)
125
    ds_map_replace(global.npc_map, npc_id, npc_flag)