Undertale Yellow script viewer

← back to main script listing

gml_Object_obj_interactable_Step_0

(view raw script w/o annotations or w/e)
1
message_length = array_length_1d(message);
2
if (keyboard_multicheck_pressed(0))
3
{
4
    if (target_direction != -1 && obj_pl.direction != target_direction)
5
        exit;
6
    if (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 && can_interact == 0)
7
    {
8
        if (global.route == 3 && global.hotland_flag[9] >= 3)
9
        {
10
            if (!instance_exists(obj_dialogue_narrator))
11
            {
12
                var narrator = instance_create_depth(0, 0, -100, obj_dialogue_narrator);
13
                with (narrator)
14
                {
15
                    if (room == rm_castle_05)
16
                        message[0] = "* (...)";
17
                    else
18
                        message[0] = "* (Not of interest.)";
19
                }
20
            }
21
            exit;
22
        }
23
        if (!instance_exists(obj_dialogue))
24
            msg = instance_create(x, y, obj_dialogue);
25
        with (msg)
26
        {
27
            portrait = false;
28
            sndfnt = 99;
29
            for (var i = 0; i < other.message_length; i++)
30
            {
31
                message[i] = other.message[i];
32
                if (i <= (array_length(other.message_col) - 1))
33
                {
34
                    for (var j = 0; j < array_length(other.message_col[i]); j++)
35
                        message_col[i][j] = other.message_col[i][j];
36
                }
37
            }
38
            if (other.color == true)
39
            {
40
                color = other.color;
41
                for (var c = 0; c < array_length_1d(other.col_modif); c++)
42
                    col_modif[c] = other.col_modif[c];
43
            }
44
        }
45
        active = true;
46
        waiter = 1;
47
    }
48
}
49
else
50
{
51
    active = false;
52
}
53
if (can_interact == 1 && !instance_exists(obj_dialogue))
54
    can_interact = 0;