Undertale Yellow script viewer

← back to main script listing

gml_Object_obj_mansion_study_tv_interact_Step_0

(view raw script w/o annotations or w/e)
1
if (live_call())
2
    return global.live_result;
3
interact = 0;
4
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)
5
    interact = 1;
6
if (ds_map_find_value(global.npc_map, npc_id) != npc_flag)
7
    ds_map_replace(global.npc_map, npc_id, npc_flag);
8
if (interact)
9
{
10
    var tape_present = scr_item_exists_check
scr_item_exists_check

function scr_item_exists_check(arg0) { for (var i = 1; i <= 8; i += 1) { if (global.item_slot[i] == arg0) { return true; exit; break; } else if (i == 8) { return false; } } }
("Videotape");
11
    scr_text
scr_text

function scr_text() { if (!instance_exists(obj_dialogue)) msg = instance_create(x, y, obj_dialogue); }
();
12
    if (!tape_present || global.dunes_flag[43] == 1)
13
    {
14
        with (msg)
15
        {
16
            message[0] = "* (An old, dusty monitor with#  nothing but static hissing at#  you.)    ";
17
            message[1] = "* (This only brings you unease.)";
18
        }
19
    }
20
    else
21
    {
22
        scene = 1;
23
        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; }
();
24
        scr_audio_fade_out
scr_audio_fade_out

function scr_audio_fade_out(arg0, arg1) { var snd = arg0; var fade_len = arg1; if (!audio_is_playing(snd)) return false; audio_sound_gain(snd, 0, fade_len); if (instance_exists(obj_audio_fade_helper)) { with (obj_audio_fade_helper) { if (audio_to_fade == snd) return false; } } with (instance_create(0, 0, obj_audio_fade_helper)) audio_to_fade = snd; }
(obj_radio.current_song, 1000);
25
    }
26
}
27
switch (scene)
28
{
29
    case 1:
30
        cutscene_dialogue();
31
        with (msg)
32
            message[0] = "* (You load the mysterious tape#  into the slot underneath the#  screen...)";
33
        break;
34
    case 2:
35
        cutscene_sfx_play(382, 1);
36
        break;
37
    case 3:
38
        obj_mansion_study_overlay.can_flicker = false;
39
        scene++;
40
        break;
41
    case 4:
42
        cutscene_wait(1.5);
43
        break;
44
    case 5:
45
        instance_create_depth(126, 91, -1600, obj_mansion_study_tv);
46
        scene++;
47
        break;
48
    case 6:
49
        draw_alpha += 0.1;
50
        if (draw_alpha >= 1)
51
            scene++;
52
        break;
53
    case 7:
54
        cutscene_wait(1.5);
55
        break;
56
    case 8:
57
        obj_mansion_study_tv.sprite_index = spr_mansion_study_tv_blue_screen;
58
        scene++;
59
        break;
60
    case 9:
61
        if (!instance_exists(obj_mansion_study_tv))
62
            cutscene_advance();
63
        break;
64
    case 10:
65
        cutscene_wait(2);
66
        break;
67
    case 11:
68
        instance_create_depth(0, 0, -3000, obj_mansion_chujin_tape_extra);
69
        scene++;
70
        break;
71
    case 12:
72
        if (!instance_exists(obj_mansion_chujin_tape_extra))
73
            cutscene_wait(2);
74
        break;
75
    case 13:
76
        draw_alpha -= 0.03;
77
        if (draw_alpha <= 0)
78
            scene++;
79
        break;
80
    case 14:
81
        cutscene_wait(1);
82
        break;
83
    case 15:
84
        scr_cutscene_end
scr_cutscene_end

function scr_cutscene_end() { global.cutscene = false; obj_pl.alarm[0] = 1; }
();
85
        scr_radio_restart
scr_radio_restart

function scr_radio_restart() { with (obj_radio) event_user(0); }
();
86
        scene = 0;
87
        global.dunes_flag[43] = 1;
88
        scr_item_remove
scr_item_remove

function scr_item_remove(arg0) { for (i = 1; i <= 8; i += 1) { if (global.item_slot[i] == arg0) { while (i < 8) { global.item_slot[i] = global.item_slot[i + 1]; i += 1; } global.item_slot[8] = "Nothing"; return true; break; } else if (i == 8) { return false; } } }
("Videotape");
89
        break;
90
}