Undertale Yellow script viewer

← back to main script listing

gml_Object_obj_steamworks_04c_puzzle_Step_0

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

function scr_text() { if (!instance_exists(obj_dialogue)) msg = instance_create(x, y, obj_dialogue); }
();
9
        with (msg)
10
            message[0] = "* (The valve won't budge.)";
11
    }
12
}
13
else if (global.sworks_flag[1] > 1)
14
{
15
    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))
16
    {
17
        scr_text
scr_text

function scr_text() { if (!instance_exists(obj_dialogue)) msg = instance_create(x, y, obj_dialogue); }
();
18
        with (msg)
19
            message[0] = "* (Best not to disturb the#  pressure you've set.)";
20
    }
21
    exit;
22
}
23
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))
24
{
25
    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; }
();
26
    audio_play_sound(snd_pinkgoo_initiate, 1, 0);
27
    liquid_active = true;
28
    scene = 1;
29
}
30
switch (scene)
31
{
32
    case 1:
33
        cutscene_camera_move(180, 110, 2);
34
        break;
35
    case 2:
36
        scr_get_input
scr_get_input

function scr_get_input() { if (live_call()) return global.live_result; scr_stick_press(); global.down_key = keyboard_check(vk_down) || gamepad_button_check(0, gp_padd) || gamepad_axis_value(0, gp_axislv); global.left_key = keyboard_check(vk_left) || gamepad_button_check(0, gp_padl) || -gamepad_axis_value(0, gp_axislh); global.right_key = keyboard_check(vk_right) || gamepad_button_check(0, gp_padr) || gamepad_axis_value(0, gp_axislh); global.up_key = keyboard_check(vk_up) || gamepad_button_check(0, gp_padu) || -gamepad_axis_value(0, gp_axislv); global.down_keyp = keyboard_check_pressed(vk_down) || gamepad_button_check_pressed(0, gp_padd) || down_stick; global.left_keyp = keyboard_check_pressed(vk_left) || gamepad_button_check_pressed(0, gp_padl) || left_stick; global.right_keyp = keyboard_check_pressed(vk_right) || gamepad_button_check_pressed(0, gp_padr) || right_stick; global.up_keyp = keyboard_check_pressed(vk_up) || gamepad_button_check_pressed(0, gp_padu) || up_stick; if (gamepad_button_check_pressed(0, gp_padd) + gamepad_button_check_pressed(0, gp_padu) + gamepad_button_check_pressed(0, gp_padl) + gamepad_button_check_pressed(0, gp_padr) + down_stick + left_stick + right_stick + up_stick + gamepad_button_check_pressed(0, global.button1) + gamepad_button_check_pressed(0, global.button2) + gamepad_button_check_pressed(0, global.button3) + instance_exists(obj_phone_controls)) global.using_gamepad = true; else if (keyboard_check(vk_anykey)) global.using_gamepad = false; if (global.using_gamepad) { if (global.button1 == gp_face1) global.action_key = "A"; else if (global.button1 == gp_face2) global.action_key = "B"; else if (global.button1 == gp_face3) global.action_key = "X"; else if (global.button1 == gp_face4) global.action_key = "Y"; if (global.button2 == gp_face1) global.cancel_key = "A"; else if (global.button2 == gp_face2) global.cancel_key = "B"; else if (global.button2 == gp_face3) global.cancel_key = "X"; else if (global.button2 == gp_face4) global.cancel_key = "Y"; if (global.button3 == 32769) global.pause_key = "A"; else if (global.button3 == 32770) global.pause_key = "B"; else if (global.button3 == 32771) global.pause_key = "X"; else if (global.button3 == 32772) global.pause_key = "Y"; } else { global.pause_key = "C"; global.action_key = "Z"; global.cancel_key = "X"; } if (instance_exists(obj_phone_controls)) { global.down_key += obj_phone_controls.phn_down; global.left_key += obj_phone_controls.phn_left; global.right_key += obj_phone_controls.phn_right; global.up_key += obj_phone_controls.phn_up; global.down_keyp = sign(global.down_keyp + obj_phone_controls.phn_downp); global.left_keyp = sign(global.left_keyp + obj_phone_controls.phn_leftp); global.right_keyp = sign(global.right_keyp + obj_phone_controls.phn_rightp); global.up_keyp = sign(global.up_keyp + obj_phone_controls.phn_upp); } }
();
37
        var shift_amount = 0.015;
38
        var liquid_current = -1;
39
        if (global.left_key)
40
            liquid_current = 0;
41
        if (global.down_key)
42
            liquid_current = 1;
43
        if (global.right_key)
44
            liquid_current = 2;
45
        if (global.up_key)
46
            liquid_current = 3;
47
        if (liquid_current != -1)
48
        {
49
            if (liquid_amount[liquid_current] < 1)
50
            {
51
                liquid_amount[liquid_current] += shift_amount;
52
                var above_zero = 0;
53
                for (var i = 0; i < array_length_1d(liquid_amount); i++)
54
                {
55
                    if (i != liquid_current && liquid_amount[i] > 0)
56
                        above_zero += 1;
57
                }
58
                for (var i = 0; i < array_length_1d(liquid_amount); i++)
59
                {
60
                    if (i != liquid_current && liquid_amount[i] > 0)
61
                        liquid_amount[i] -= shift_amount / above_zero;
62
                }
63
            }
64
        }
65
        var completed = 0;
66
        for (var i = 0; i < array_length_1d(liquid_amount); i++)
67
        {
68
            liquid_amount[i] = clamp(liquid_amount[i], 0, 1);
69
            if (liquid_amount[i] > (liquid_target[i] - 0.1) && liquid_amount[i] < (liquid_target[i] + 0.1))
70
            {
71
                completed += 1;
72
                if (liquid_noloop[i] == 0)
73
                {
74
                    liquid_noloop[i] = 1;
75
                    var ding_sound = audio_play_sound(snd_duel_mark, 1, 0);
76
                    audio_sound_pitch(ding_sound, 0.8 + (completed * 0.2));
77
                }
78
            }
79
            else
80
            {
81
                liquid_noloop[i] = 0;
82
            }
83
        }
84
        if (completed == 4)
85
        {
86
            audio_play_sound(snd_undertale_snap, 1, 0);
87
            audio_play_sound(snd_success, 1, 0);
88
            scene = 3;
89
        }
90
        if (global.right_keyp || global.left_keyp || global.down_keyp || global.up_keyp)
91
            audio_play_sound(snd_pinkgoo_steam, 1, 0);
92
        if (global.right_key || global.left_key || global.down_key || global.up_key)
93
        {
94
            if (!audio_is_playing(snd_pinkgoo_move))
95
                audio_play_sound(snd_pinkgoo_move, 1, 1);
96
        }
97
        else if (audio_is_playing(snd_pinkgoo_move))
98
        {
99
            audio_stop_sound(snd_pinkgoo_move);
100
        }
101
        if (keyboard_multicheck_pressed(1))
102
        {
103
            if (audio_is_playing(snd_pinkgoo_move))
104
                audio_stop_sound(snd_pinkgoo_move);
105
            audio_play_sound(snd_fail, 1, 0);
106
            scene = 6;
107
        }
108
        break;
109
    case 3:
110
        if (audio_is_playing(snd_pinkgoo_move))
111
            audio_stop_sound(snd_pinkgoo_move);
112
        cutscene_screenshake(0.5, 2);
113
        break;
114
    case 4:
115
        cutscene_wait(1.5);
116
        break;
117
    case 5:
118
        if (!instance_exists(obj_steamworks_04_c_cutscene))
119
            instance_create(0, 0, obj_steamworks_04_c_cutscene);
120
        break;
121
    case 6:
122
        cutscene_camera_move(obj_pl.x, obj_pl.y, 2);
123
        break;
124
    case 7:
125
        __view_set(e__VW.Object, 0, obj_pl);
126
        scene = 0;
127
        scr_cutscene_end
scr_cutscene_end

function scr_cutscene_end() { global.cutscene = false; obj_pl.alarm[0] = 1; }
();
128
        break;
129
}
130
if (liquid_overlay_deg < 360)
131
    liquid_overlay_deg += 0.1;
132
else
133
    liquid_overlay_deg = 0;
134
liquid_overlay_alpha = 0.25 + (sin(liquid_overlay_deg) * 0.25);
135
if (scene >= 3 && scene < 6)
136
{
137
    for (var i = 0; i < array_length_1d(liquid_amount); i++)
138
        liquid_amount[i] = lerp(liquid_amount[i], liquid_target[i], 0.1);
139
}
140
141
enum e__VW
142
{
143
    XView,
144
    YView,
145
    WView,
146
    HView,
147
    Angle,
148
    HBorder,
149
    VBorder,
150
    HSpeed,
151
    VSpeed,
152
    Object,
153
    Visible,
154
    XPort,
155
    YPort,
156
    WPort,
157
    HPort,
158
    Camera,
159
    SurfaceID
160
}