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() //gml_Script_scr_interact { if (distance_to_object(obj_pl) < 20 && obj_pl.state == gml_Script_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() //gml_Script_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() //gml_Script_scr_interact { if (distance_to_object(obj_pl) < 20 && obj_pl.state == gml_Script_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() //gml_Script_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
    return;
22
}
23
if (scr_interact
scr_interact

function scr_interact() //gml_Script_scr_interact { if (distance_to_object(obj_pl) < 20 && obj_pl.state == gml_Script_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() //gml_Script_scr_cutscene_start { global.cutscene = true obj_pl.state = gml_Script_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() //gml_Script_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
                liquid_noloop[i] = 0
111
        }
112
        if (completed == 3)
113
        {
114
            audio_play_sound(snd_undertale_snap, 1, 0)
115
            audio_play_sound(snd_success, 1, 0)
116
            scene = 3
117
        }
118
        if (global.right_keyp || global.left_keyp || global.down_keyp)
119
            audio_play_sound(snd_pinkgoo_steam, 1, 0)
120
        if (global.right_key || global.left_key || global.down_key || global.up_key)
121
        {
122
            if (!audio_is_playing(snd_pinkgoo_move))
123
                audio_play_sound(snd_pinkgoo_move, 1, 1)
124
        }
125
        else if audio_is_playing(snd_pinkgoo_move)
126
            audio_stop_sound(snd_pinkgoo_move)
127
        if keyboard_multicheck_pressed(1)
128
        {
129
            if audio_is_playing(snd_pinkgoo_move)
130
                audio_stop_sound(snd_pinkgoo_move)
131
            audio_play_sound(snd_fail, 1, 0)
132
            scene = 6
133
        }
134
        break
135
    case 3:
136
        if audio_is_playing(snd_pinkgoo_move)
137
            audio_stop_sound(snd_pinkgoo_move)
138
        cutscene_screenshake(0.5, 2)
139
        break
140
    case 4:
141
        cutscene_wait(1.5)
142
        break
143
    case 5:
144
        if (!instance_exists(obj_steamworks_04_b_cutscene))
145
            instance_create(0, 0, obj_steamworks_04_b_cutscene)
146
        break
147
    case 6:
148
        cutscene_camera_move(obj_pl.x, obj_pl.y, 2)
149
        break
150
    case 7:
151
        __view_set((9 << 0), 0, 1031)
152
        scene = 0
153
        scr_cutscene_end
scr_cutscene_end

function scr_cutscene_end() //gml_Script_scr_cutscene_end { global.cutscene = false obj_pl.alarm[0] = 1 }
()
154
        break
155
}
156
157
if (liquid_overlay_deg < 360)
158
    liquid_overlay_deg += 0.1
159
else
160
    liquid_overlay_deg = 0
161
liquid_overlay_alpha = 0.25 + sin(liquid_overlay_deg) * 0.25
162
if (scene >= 3 && scene < 6)
163
{
164
    for (i = 0; i < array_length_1d(liquid_amount); i++)
165
        liquid_amount[i] = lerp(liquid_amount[i], liquid_target[i], 0.1)
166
}