Undertale Yellow script viewer

← back to main script listing

gml_Object_obj_cake_Step_0

(view raw script w/o annotations or w/e)
1
event_inherited();
2
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; } }
() && keyboard_multicheck_pressed(0))
3
{
4
    if (global.geno_complete[3] == true)
5
    {
6
        scr_text
scr_text

function scr_text() { if (!instance_exists(obj_dialogue)) msg = instance_create(x, y, obj_dialogue); }
();
7
        with (msg)
8
            message[0] = "* (A cake in its cage.)";
9
    }
10
    else
11
    {
12
        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; }
();
13
        waiter = 1;
14
    }
15
}
16
if (waiter == 1)
17
{
18
    scr_text
scr_text

function scr_text() { if (!instance_exists(obj_dialogue)) msg = instance_create(x, y, obj_dialogue); }
();
19
    with (msg)
20
    {
21
        if (other.npc_flag == 1)
22
        {
23
            message[0] = "* (It's empty now.)";
24
            if (!global.dialogue_open)
25
            {
26
                scr_cutscene_end
scr_cutscene_end

function scr_cutscene_end() { global.cutscene = false; obj_pl.alarm[0] = 1; }
();
27
                other.waiter = 0;
28
            }
29
            exit;
30
        }
31
        message[0] = "* (You would like some Cake but#  you'd rather not alert Axis.)";
32
        message[1] = "* (Risk it?)";
33
        ch_msg = 1;
34
        ch[1] = "Yes";
35
        ch[2] = "No";
36
        if (outcome == 1)
37
        {
38
            if (scr_item
scr_item

function scr_item(arg0) { nm = arg0; for (var i = 1; i <= 8; i++) { if (global.item_slot[i] == "Nothing") { global.item_slot[i] = nm; return true; break; } else if (i == 8) { return false; } } }
("Cake"))
39
            {
40
                other.waiter = 2;
41
                global.dialogue_open = false;
42
            }
43
            else
44
            {
45
                message[2] = "* (Not enough space.)";
46
                global.cutscene = false;
47
                other.waiter = 0;
48
            }
49
        }
50
        if (outcome == 2)
51
        {
52
            message[2] = "* (Better safe than sorry.)";
53
            other.waiter = 0;
54
            global.cutscene = false;
55
        }
56
    }
57
}
58
if (waiter == 2)
59
{
60
    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, 100);
61
    pain_sound = audio_play_sound(snd_chem_cake_take, 1, 0);
62
    waiter = 3;
63
}
64
if (waiter == 3)
65
{
66
    if (audio_is_playing(pain_sound))
67
        exit;
68
    else if (!alarm[0])
69
        alarm[0] = 30;
gml_Object_obj_cake_Alarm_0.gml

audio_play_sound(snd_success, 1, 0); scr_text(); with (msg) message[0] = "* (...Phew.)"; npc_flag = 1; other.image_index = 1; waiter = 0; global.cutscene = false; scr_radio_restart();
70
}