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() //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] > 1)
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(180, 110, 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
        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 (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 (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
                liquid_noloop[i] = 0
81
        }
82
        if (completed == 4)
83
        {
84
            audio_play_sound(snd_undertale_snap, 1, 0)
85
            audio_play_sound(snd_success, 1, 0)
86
            scene = 3
87
        }
88
        if (global.right_keyp || global.left_keyp || global.down_keyp || global.up_keyp)
89
            audio_play_sound(snd_pinkgoo_steam, 1, 0)
90
        if (global.right_key || global.left_key || global.down_key || global.up_key)
91
        {
92
            if (!audio_is_playing(snd_pinkgoo_move))
93
                audio_play_sound(snd_pinkgoo_move, 1, 1)
94
        }
95
        else if audio_is_playing(snd_pinkgoo_move)
96
            audio_stop_sound(snd_pinkgoo_move)
97
        if keyboard_multicheck_pressed(1)
98
        {
99
            if audio_is_playing(snd_pinkgoo_move)
100
                audio_stop_sound(snd_pinkgoo_move)
101
            audio_play_sound(snd_fail, 1, 0)
102
            scene = 6
103
        }
104
        break
105
    case 3:
106
        if audio_is_playing(snd_pinkgoo_move)
107
            audio_stop_sound(snd_pinkgoo_move)
108
        cutscene_screenshake(0.5, 2)
109
        break
110
    case 4:
111
        cutscene_wait(1.5)
112
        break
113
    case 5:
114
        if (!instance_exists(obj_steamworks_04_c_cutscene))
115
            instance_create(0, 0, obj_steamworks_04_c_cutscene)
116
        break
117
    case 6:
118
        cutscene_camera_move(obj_pl.x, obj_pl.y, 2)
119
        break
120
    case 7:
121
        __view_set((9 << 0), 0, 1031)
122
        scene = 0
123
        scr_cutscene_end
scr_cutscene_end

function scr_cutscene_end() //gml_Script_scr_cutscene_end { global.cutscene = false obj_pl.alarm[0] = 1 }
()
124
        break
125
}
126
127
if (liquid_overlay_deg < 360)
128
    liquid_overlay_deg += 0.1
129
else
130
    liquid_overlay_deg = 0
131
liquid_overlay_alpha = 0.25 + sin(liquid_overlay_deg) * 0.25
132
if (scene >= 3 && scene < 6)
133
{
134
    for (i = 0; i < array_length_1d(liquid_amount); i++)
135
        liquid_amount[i] = lerp(liquid_amount[i], liquid_target[i], 0.1)
136
}