Undertale Yellow script viewer

← back to main script listing

gml_Object_obj_dialogue_special_Step_0

(view raw script w/o annotations or w/e)
1
if (live_call())
2
    return global.live_result;
3
if (!can_draw)
4
    exit;
5
if (global.dialogue_open == false)
6
{
7
    if (instance_exists(obj_pl))
8
        obj_pl.alarm[0] = 1;
9
    instance_destroy();
10
}
11
if (letter_array == -1)
12
{
13
    for (var i = 1; i <= string_length(message[message_current]); i++)
14
    {
15
        letter_array[i] = string_char_at(message[message_current], i);
16
        if (i > 1)
17
            text_x[i] = text_x[clamp(i - 1, 1, 9999)] + str_width;
18
        text_y[i] = text_y[clamp(i - 1, 1, 9999)];
19
        if (letter_array[i] == "#")
20
        {
21
            text_y[i] += 20;
22
            text_x[i] = text_x[1] - str_width;
23
        }
24
    }
25
}
26
if (letter_current < (array_length(letter_array) - 1))
27
{
28
    can_skip = false;
29
    if (letter_waiter == 0)
30
    {
31
        letter_current += letter_speed;
32
        if (floor(letter_current) == letter_current)
33
        {
34
            switch (letter_array[letter_current])
35
            {
36
                case " ":
37
                case ".":
38
                case "#":
39
                    break;
40
                default:
41
                    audio_stop_sound(sndfnt);
42
                    audio_play_sound(sndfnt, 1, false);
43
                    break;
44
            }
45
        }
46
    }
47
}
48
else
49
{
50
    can_skip = true;
51
}
52
if (keyboard_multicheck_pressed(0) && skippable == true && can_skip == true)
53
{
54
    message_advance = true;
55
    can_skip = false;
56
}
57
if (letter_waiter > 0)
58
    letter_waiter--;
59
if (keyboard_multicheck_pressed(1) && skippable == true)
60
    letter_current = array_length(letter_array) - 1;
61
if (message_advance == true)
62
{
63
    message_advance = false;
64
    if ((message_current + 1) < array_length_1d(message))
65
    {
66
        letter_array = -1;
67
        message_current += 1;
68
        letter_current = 0;
69
    }
70
    else
71
    {
72
        global.dialogue_open = false;
73
    }
74
}
75
if (mode == "swirl")
76
{
77
    swirl_deg -= 10;
78
    if (swirl_deg <= 0)
79
        swirl_deg += 360;
80
}