Undertale Yellow script viewer

← back to main script listing

gml_Object_obj_dialogue_narrator_Step_0

(view raw script w/o annotations or w/e)
1
if live_call()
2
    return global.live_result;
3
if (local_dialogue_open == false)
4
    instance_destroy()
5
if (letter_array == -1)
6
{
7
    for (var i = 1; i <= string_length(message[message_current]); i++)
8
    {
9
        text_alpha[i] = 0
10
        letter_array[i] = string_char_at(message[message_current], i)
11
        if (i > 1)
12
            text_x[i] = (text_x[clamp((i - 1), 1, 9999)]) + str_width
13
        text_y[i] = text_y[clamp((i - 1), 1, 9999)]
14
        if (letter_array[i] == "#")
15
        {
16
            text_y[i] += 20
17
            text_x[i] = text_x[1] - str_width
18
        }
19
    }
20
}
21
if (letter_current < (array_length(letter_array) - 1))
22
{
23
    if (letter_waiter == 0)
24
    {
25
        letter_current += letter_speed
26
        if (floor(letter_current) == letter_current)
27
        {
28
            switch letter_array[letter_current]
29
            {
30
                case " ":
31
                case ".":
32
                case "#":
33
                    break
34
                default:
35
                    break
36
            }
37
38
        }
39
    }
40
}
41
else if ((!alarm[0]) && (!message_advance))
42
    alarm[0] = 30
alarm[0]

message_advance = 1
43
if (letter_waiter > 0)
44
    letter_waiter--
45
if (message_advance == 1)
46
{
47
    draw_alpha -= 0.05
48
    if (draw_alpha <= 0)
49
    {
50
        for (i = 0; i <= letter_current; i++)
51
            text_alpha[i] = 0
52
        draw_alpha = 0
53
        message_advance += 1
54
    }
55
    else
56
        return;
57
}
58
else if (message_advance == 2)
59
{
60
    message_advance = 0
61
    if ((message_current + 1) < array_length_1d(message))
62
    {
63
        letter_array = -1
64
        message_current += 1
65
        letter_current = 0
66
    }
67
    else
68
        local_dialogue_open = false
69
}
70
if (message_advance != 1)
71
{
72
    if (draw_alpha < 1)
73
        draw_alpha += 0.1
74
}
75
for (i = 0; i <= letter_current; i++)
76
{
77
    if (text_alpha[i] < 1)
78
        text_alpha[i] += 0.1
79
}