Undertale Yellow script viewer

← back to main script listing

gml_Object_obj_chem_05_computer_Step_0

(view raw script w/o annotations or w/e)
1
if (live_call())
2
    return global.live_result;
3
switch (screen_state)
4
{
5
    case 0:
6
        with (obj_compound_parent)
7
        {
8
            if (robot_item_is_carried == true)
9
            {
10
                if (point_distance(x, y, other.x + 55, other.y + 64) < 30)
11
                {
12
                    if (other.item_throw_noloop == false || keyboard_multicheck_pressed(1))
13
                    {
14
                        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; }
();
15
                        robot_item_x_target = 165;
16
                        robot_item_y_target = 132;
17
                        other.screen_state += 1;
18
                        other.compound_active = id;
19
                        other.item_throw_noloop = true;
20
                    }
21
                }
22
                else
23
                {
24
                    other.item_throw_noloop = false;
25
                }
26
            }
27
        }
28
        if (keyboard_multicheck_pressed(0) && 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; } }
() && screen_interact_noloop == false)
29
        {
30
            screen_counter = 0;
31
            screen_message = "...\nWaiting for correct\ncompounds to complete\nmixture . . .";
32
            if (global.route == 3)
33
                screen_message = "ERROR: Power low";
34
            screen_interact_noloop = true;
35
        }
36
        break;
37
    case 1:
38
        with (compound_active)
39
        {
40
            if (robot_item_is_jumping == false)
41
            {
42
                robot_item_is_jumping = true;
43
                audio_play_sound(snd_playerjump, 1, 0);
44
            }
45
            other.screen_state += 1;
46
        }
47
        break;
48
    case 2:
49
        with (compound_active)
50
        {
51
            if (robot_item_is_jumping)
52
                exit;
53
            if (image_alpha >= 0)
54
            {
55
                image_alpha -= 0.05;
56
            }
57
            else
58
            {
59
                other.screen_counter = 0;
60
                other.screen_message = "Reading. . .";
61
                other.screen_state += 1;
62
            }
63
        }
64
        break;
65
    case 3:
66
        if (!alarm[1])
67
            alarm[1] = room_speed * 1;
gml_Object_obj_chem_05_computer_Alarm_1.gml

if (live_call()) return global.live_result; screen_state += 1;
68
        break;
69
    case 4:
70
        screen_counter = 0;
71
        screen_message = compound_active.compound_id;
72
        screen_state += 1;
73
        break;
74
    case 5:
75
        if (!alarm[1])
76
            alarm[1] = room_speed * 1;
gml_Object_obj_chem_05_computer_Alarm_1.gml

if (live_call()) return global.live_result; screen_state += 1;
77
        break;
78
    case 6:
79
        screen_message += "\nVerdict: ";
80
        screen_state += 1;
81
        break;
82
    case 7:
83
        if (!alarm[1])
84
            alarm[1] = room_speed * 0.5;
gml_Object_obj_chem_05_computer_Alarm_1.gml

if (live_call()) return global.live_result; screen_state += 1;
85
        break;
86
    case 8:
87
        if (compound_active.compound_id == "Chlorine [Cl]" || compound_active.compound_id == "Hydrogen [H]")
88
        {
89
            compound_count += 1;
90
            compound_destroy = true;
91
            if (global.route == 3)
92
                screen_message += "Acception Message";
93
            else
94
                screen_message += "Accepted.";
95
        }
96
        else
97
        {
98
            if (global.route == 3)
99
                screen_message += "Rejection Message";
100
            else
101
                screen_message += "Declined.";
102
            compound_destroy = true;
103
            with (compound_active)
104
            {
105
            }
106
        }
107
        screen_state += 1;
108
        break;
109
    case 9:
110
        if (!alarm[1])
111
            alarm[1] = room_speed * 1;
gml_Object_obj_chem_05_computer_Alarm_1.gml

if (live_call()) return global.live_result; screen_state += 1;
112
        break;
113
    case 10:
114
        if (global.route != 3)
115
        {
116
            scr_text
scr_text

function scr_text() { if (!instance_exists(obj_dialogue)) msg = instance_create(x, y, obj_dialogue); }
();
117
            var compound_id = compound_active;
118
            with (msg)
119
            {
120
                for (var i = 0; i < array_length(compound_id.message); i++)
121
                {
122
                    col_modif[0] = 65280;
123
                    message[i] = compound_id.message[i];
124
                    message_col[i][0] = message[i];
125
                    color = true;
126
                }
127
            }
128
        }
129
        if (!global.dialogue_open)
130
            screen_state += 1;
131
        break;
132
    case 11:
133
        if (compound_destroy == true)
134
            instance_destroy(compound_active);
135
        if (compound_count == 0)
136
        {
137
            screen_counter = 0;
138
            screen_message = "...\nWaiting for correct\ncompounds to complete\nmixture . . .";
139
            if (global.route == 3)
140
                screen_message = "ERROR: Power low";
141
            screen_interact_noloop = true;
142
        }
143
        else
144
        {
145
            screen_counter = 0;
146
            var status_1 = "MISSING";
147
            var status_2 = "MISSING";
148
            if (compound_count > 0)
149
                status_1 = "PRESENT";
150
            if (compound_count > 1)
151
                status_2 = "PRESENT";
152
            screen_message = "Status:\nCompound 1: " + status_1 + "\nCompound 2: " + status_2;
153
            screen_interact_noloop = true;
154
        }
155
        if (compound_count > 1)
156
        {
157
            screen_message = ". . .Booting process.";
158
            if (global.route == 3)
159
                screen_message = ". . .";
160
            screen_state += 1;
161
        }
162
        else
163
        {
164
            screen_state = 0;
165
            scr_cutscene_end
scr_cutscene_end

function scr_cutscene_end() { global.cutscene = false; obj_pl.alarm[0] = 1; }
();
166
        }
167
        break;
168
    case 12:
169
        if (!alarm[1])
170
            alarm[1] = room_speed * 2;
gml_Object_obj_chem_05_computer_Alarm_1.gml

if (live_call()) return global.live_result; screen_state += 1;
171
        break;
172
    case 13:
173
        if (global.route == 3)
174
            screen_message += "\nITEMs ready\nApproach terminal";
175
        else
176
            screen_message += "\nBoot complete.\nMixing initialized.";
177
        screen_state += 1;
178
    case 14:
179
        if (!alarm[1])
180
            alarm[1] = room_speed * 1.5;
gml_Object_obj_chem_05_computer_Alarm_1.gml

if (live_call()) return global.live_result; screen_state += 1;
181
        break;
182
    case 15:
183
        instance_create_depth(0, 0, -room_height, obj_chem_05_maze_puzzle);
184
        screen_state += 1;
185
        break;
186
    case 16:
187
        if (!instance_exists(obj_chem_05_maze_puzzle))
188
            screen_state += 1;
189
        break;
190
    case 17:
191
        screen_counter = 0;
192
        screen_message = "Mixing process\ncomplete. Enjoy your\ndeadly acid :)";
193
        if (global.route == 3)
194
            screen_message = "Your ITEM is ready";
195
        screen_interact_noloop = true;
196
        screen_state += 1;
197
        break;
198
    case 18:
199
        if (!alarm[1])
200
            alarm[1] = room_speed * 1.5;
gml_Object_obj_chem_05_computer_Alarm_1.gml

if (live_call()) return global.live_result; screen_state += 1;
201
        break;
202
    case 19:
203
        audio_play_sound(snd_success, 1, 0);
204
        instance_create(264, 158, obj_steamworks_05_acid);
205
        scr_cutscene_end
scr_cutscene_end

function scr_cutscene_end() { global.cutscene = false; obj_pl.alarm[0] = 1; }
();
206
        global.sworks_flag[25] = 2;
207
        screen_state += 1;
208
        break;
209
}
210
if (screen_counter < string_length(screen_message))
211
{
212
    if (keyboard_multicheck_pressed(1) && screen_state > 0)
213
        screen_counter = string_length(screen_message);
214
    screen_counter += 1;
215
    if (screen_counter == floor(screen_counter))
216
        audio_play_sound(snd_talk_default, 1, 0);
217
    screen_cursor = "_";
218
    alarm[0] = room_speed;
gml_Object_obj_chem_05_computer_Alarm_0.gml

if (live_call()) return global.live_result; if (screen_cursor == "_") screen_cursor = ""; else screen_cursor = "_"; alarm[0] = room_speed;
219
}
220
screen_message_current = string_copy(screen_message, 0, screen_counter);