Undertale Yellow script viewer

← back to main script listing

gml_Object_obj_steamworks_04b_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] > 0)
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(190, 100, 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
        if (global.left_key)
39
        {
40
            if (liquid_amount[0] < 1)
41
                liquid_amount[0] += shift_amount;
42
            if (liquid_amount[1] > 0)
43
            {
44
                if (liquid_amount[2] > 0)
45
                    liquid_amount[1] -= shift_amount / 2;
46
                else
47
                    liquid_amount[1] -= shift_amount;
48
            }
49
            if (liquid_amount[2] > 0)
50
            {
51
                if (liquid_amount[1] > 0)
52
                    liquid_amount[2] -= shift_amount / 2;
53
                else
54
                    liquid_amount[2] -= shift_amount;
55
            }
56
        }
57
        if (global.right_key)
58
        {
59
            if (liquid_amount[2] < 1)
60
                liquid_amount[2] += shift_amount;
61
            if (liquid_amount[1] > 0)
62
            {
63
                if (liquid_amount[0] > 0)
64
                    liquid_amount[1] -= shift_amount / 2;
65
                else
66
                    liquid_amount[1] -= shift_amount;
67
            }
68
            if (liquid_amount[0] > 0)
69
            {
70
                if (liquid_amount[1] > 0)
71
                    liquid_amount[0] -= shift_amount / 2;
72
                else
73
                    liquid_amount[0] -= shift_amount;
74
            }
75
        }
76
        if (global.down_key)
77
        {
78
            if (liquid_amount[1] < 1)
79
                liquid_amount[1] += shift_amount;
80
            if (liquid_amount[2] > 0)
81
            {
82
                if (liquid_amount[0] > 0)
83
                    liquid_amount[2] -= shift_amount / 2;
84
                else
85
                    liquid_amount[2] -= shift_amount;
86
            }
87
            if (liquid_amount[0] > 0)
88
            {
89
                if (liquid_amount[2] > 0)
90
                    liquid_amount[0] -= shift_amount / 2;
91
                else
92
                    liquid_amount[0] -= shift_amount;
93
            }
94
        }
95
        var completed = 0;
96
        for (var i = 0; i < array_length_1d(liquid_amount); i++)
97
        {
98
            liquid_amount[i] = clamp(liquid_amount[i], 0, 1);
99
            if (liquid_amount[i] > (liquid_target[i] - 0.1) && liquid_amount[i] < (liquid_target[i] + 0.1))
100
            {
101
                completed += 1;
102
                if (liquid_noloop[i] == 0)
103
                {
104
                    liquid_noloop[i] = 1;
105
                    var ding_sound = audio_play_sound(snd_duel_mark, 1, 0);
106
                    audio_sound_pitch(ding_sound, 0.8 + (completed * 0.2));
107
                }
108
            }
109
            else
110
            {
111
                liquid_noloop[i] = 0;
112
            }
113
        }
114
        if (completed == 3)
115
        {
116
            audio_play_sound(snd_undertale_snap, 1, 0);
117
            audio_play_sound(snd_success, 1, 0);
118
            scene = 3;
119
        }
120
        if (global.right_keyp || global.left_keyp || global.down_keyp)
121
            audio_play_sound(snd_pinkgoo_steam, 1, 0);
122
        if (global.right_key || global.left_key || global.down_key || global.up_key)
123
        {
124
            if (!audio_is_playing(snd_pinkgoo_move))
125
                audio_play_sound(snd_pinkgoo_move, 1, 1);
126
        }
127
        else if (audio_is_playing(snd_pinkgoo_move))
128
        {
129
            audio_stop_sound(snd_pinkgoo_move);
130
        }
131
        if (keyboard_multicheck_pressed(1))
132
        {
133
            if (audio_is_playing(snd_pinkgoo_move))
134
                audio_stop_sound(snd_pinkgoo_move);
135
            audio_play_sound(snd_fail, 1, 0);
136
            scene = 6;
137
        }
138
        break;
139
    case 3:
140
        if (audio_is_playing(snd_pinkgoo_move))
141
            audio_stop_sound(snd_pinkgoo_move);
142
        cutscene_screenshake(0.5, 2);
143
        break;
144
    case 4:
145
        cutscene_wait(1.5);
146
        break;
147
    case 5:
148
        if (!instance_exists(obj_steamworks_04_b_cutscene))
149
            instance_create(0, 0, obj_steamworks_04_b_cutscene);
150
        break;
151
    case 6:
152
        cutscene_camera_move(obj_pl.x, obj_pl.y, 2);
153
        break;
154
    case 7:
155
        __view_set(e__VW.Object, 0, obj_pl);
156
        scene = 0;
157
        scr_cutscene_end
scr_cutscene_end

function scr_cutscene_end() { global.cutscene = false; obj_pl.alarm[0] = 1; }
();
158
        break;
159
}
160
if (liquid_overlay_deg < 360)
161
    liquid_overlay_deg += 0.1;
162
else
163
    liquid_overlay_deg = 0;
164
liquid_overlay_alpha = 0.25 + (sin(liquid_overlay_deg) * 0.25);
165
if (scene >= 3 && scene < 6)
166
{
167
    for (var i = 0; i < array_length_1d(liquid_amount); i++)
168
        liquid_amount[i] = lerp(liquid_amount[i], liquid_target[i], 0.1);
169
}
170
171
enum e__VW
172
{
173
    XView,
174
    YView,
175
    WView,
176
    HView,
177
    Angle,
178
    HBorder,
179
    VBorder,
180
    HSpeed,
181
    VSpeed,
182
    Object,
183
    Visible,
184
    XPort,
185
    YPort,
186
    WPort,
187
    HPort,
188
    Camera,
189
    SurfaceID
190
}