Undertale Yellow script viewer

← back to main script listing

gml_GlobalScript_cts_shufflers_puzzle

(view raw script w/o annotations or w/e)
1
function cts_shufflers_puzzle() //gml_Script_cts_shufflers_puzzle
2
{
3
    scr_shuffle_controls_snowdin_13_yellow
scr_shuffle_controls_snowdin_13_yellow

function scr_shuffle_controls_snowdin_13_yellow() //gml_Script_scr_shuffle_controls_snowdin_13_yellow { var key_left = global.left_keyp var key_right = global.right_keyp var key_select = keyboard_multicheck_pressed(0) if (shufflers_select == true) { if key_right { audio_play_sound(snd_mainmenu_select, 20, 0) switch current_shuffler { case 0: current_shuffler = 1 break case 1: current_shuffler = 2 break case 2: current_shuffler = 0 break } } if key_left { audio_play_sound(snd_mainmenu_select, 20, 0) switch current_shuffler { case 0: current_shuffler = 2 break case 1: current_shuffler = 0 break case 2: current_shuffler = 1 break } } if key_select { audio_play_sound(snd_confirm, 20, 0) shufflers_select = false timer += 1 } } }
()
4
    if (timer < 60)
5
    {
6
        if (timer >= 0)
7
        {
8
            with (obj_snowdin_13_swig)
9
            {
10
                if (sprite_index != spr_swig_flip_overworld_yellow)
11
                {
12
                    audio_play_sound(snd_shufflers_flip, 20, 0)
13
                    sprite_index = spr_swig_flip_overworld_yellow
14
                    image_index = 0
15
                    image_speed = 0.5
16
                }
17
                else if (image_index == (image_number - 1) && image_alpha != 0)
18
                {
19
                    image_speed = 0
20
                    image_index = image_number - 1
21
                    image_alpha = 0
22
                    instance_create(x, y, obj_snowdin_13_shuffler_overworld_yellow)
23
                }
24
            }
25
        }
26
        if (timer >= 15)
27
        {
28
            with (obj_snowdin_13_rephil)
29
            {
30
                if (sprite_index != spr_rephil_flip_overworld_yellow)
31
                {
32
                    audio_play_sound(snd_shufflers_flip, 20, 0)
33
                    sprite_index = spr_rephil_flip_overworld_yellow
34
                    image_index = 0
35
                    image_speed = 0.5
36
                }
37
                else if (image_index == (image_number - 1) && image_alpha != 0)
38
                {
39
                    image_speed = 0
40
                    image_index = image_number - 1
41
                    image_alpha = 0
42
                    instance_create(x, y, obj_snowdin_13_shuffler_overworld_yellow)
43
                }
44
            }
45
        }
46
        if (timer >= 30)
47
        {
48
            with (obj_snowdin_13_toast)
49
            {
50
                if (sprite_index != spr_toast_flip_overworld_yellow)
51
                {
52
                    audio_play_sound(snd_shufflers_flip, 20, 0)
53
                    sprite_index = spr_toast_flip_overworld_yellow
54
                    image_index = 0
55
                    image_speed = 0.5
56
                }
57
                else if (image_index == (image_number - 1) && image_alpha != 0)
58
                {
59
                    image_speed = 0
60
                    image_index = image_number - 1
61
                    image_alpha = 0
62
                    instance_create(x, y, obj_snowdin_13_shuffler_overworld_yellow)
63
                }
64
            }
65
        }
66
    }
67
    if (timer == 90)
68
    {
69
        scr_audio_fade
scr_audio_fade

function scr_audio_fade(argument0, argument1) //gml_Script_scr_audio_fade { var snd = argument0 var fade_len = argument1 with (obj_radio) { audio_other_fade = true audio_to_fade = snd audio_fade_length = fade_len } }
(156, 500)
70
        with (obj_snowdin_13_shuffler_overworld_yellow)
71
            has_ball = false
72
        current_shuffler = irandom(2)
73
        shuffler[0] = instance_position(130, 200, obj_snowdin_13_shuffler_overworld_yellow)
74
        shuffler[1] = instance_position(160, 200, obj_snowdin_13_shuffler_overworld_yellow)
75
        shuffler[2] = instance_position(190, 200, obj_snowdin_13_shuffler_overworld_yellow)
76
    }
77
    if (timer >= 90 && timer < 140)
78
    {
79
        with (shuffler[current_shuffler])
80
        {
81
            has_ball = true
82
            sprite_index = spr_shuffler_ball_overworld_yellow
83
            if (image_index >= (image_number - 1))
84
                image_speed = 0
85
            else
86
                image_speed = 0.2
87
        }
88
    }
89
    if (timer >= 140 && timer < 190)
90
    {
91
        with (shuffler[current_shuffler])
92
        {
93
            sprite_index = spr_shuffler_ball_overworld_yellow
94
            image_speed = -0.2
95
            if (floor(image_index) <= 0)
96
            {
97
                image_speed = 0
98
                image_index = 0
99
            }
100
        }
101
    }
102
    if (timer == 189)
103
    {
104
        audio_stop_sound(shuffle_music)
105
        switch shufflers_round
106
        {
107
            case 1:
108
                timer = 200
109
                shuffle_music = mus_shuffling1
110
                break
111
            case 2:
112
                timer = 610
113
                shuffle_music = mus_shuffling2
114
                break
115
            case 3:
116
                timer = 750
117
                shuffle_music = mus_shuffling3
118
                break
119
        }
120
121
        audio_play_sound(shuffle_music, 1, 1)
122
        audio_sound_gain(shuffle_music, 1, 0)
123
    }
124
    switch timer
125
    {
126
        case 210:
127
        case 225:
128
        case 240:
129
        case 255:
130
        case 270:
131
            current_shuffler = irandom(2)
132
            scr_shuffle_snowdin_13_yellow
scr_shuffle_snowdin_13_yellow

function scr_shuffle_snowdin_13_yellow() //gml_Script_scr_shuffle_snowdin_13_yellow { var shuffle_direction = irandom(1) if position_meeting(130, 200, shuffler[current_shuffler]) { with (shuffler[current_shuffler]) move_right = true var shuff = instance_position(160, 200, obj_snowdin_13_shuffler_overworld_yellow) with (shuff) move_left = true } else if position_meeting(160, 200, shuffler[current_shuffler]) { if (shuffle_direction == 0) { with (shuffler[current_shuffler]) move_right = true shuff = instance_position(190, 200, obj_snowdin_13_shuffler_overworld_yellow) with (shuff) move_left = true } else if (shuffle_direction == 1) { with (shuffler[current_shuffler]) move_left = true shuff = instance_position(130, 200, obj_snowdin_13_shuffler_overworld_yellow) with (shuff) move_right = true } } else if position_meeting(190, 200, shuffler[current_shuffler]) { with (shuffler[current_shuffler]) move_left = true shuff = instance_position(160, 200, obj_snowdin_13_shuffler_overworld_yellow) with (shuff) move_right = true } }
()
133
            break
134
        case 620:
135
        case 630:
136
        case 640:
137
        case 650:
138
        case 660:
139
        case 670:
140
        case 680:
141
        case 690:
142
        case 700:
143
        case 710:
144
        case 720:
145
        case 730:
146
            current_shuffler = irandom(2)
147
            scr_shuffle_snowdin_13_yellow
scr_shuffle_snowdin_13_yellow

function scr_shuffle_snowdin_13_yellow() //gml_Script_scr_shuffle_snowdin_13_yellow { var shuffle_direction = irandom(1) if position_meeting(130, 200, shuffler[current_shuffler]) { with (shuffler[current_shuffler]) move_right = true var shuff = instance_position(160, 200, obj_snowdin_13_shuffler_overworld_yellow) with (shuff) move_left = true } else if position_meeting(160, 200, shuffler[current_shuffler]) { if (shuffle_direction == 0) { with (shuffler[current_shuffler]) move_right = true shuff = instance_position(190, 200, obj_snowdin_13_shuffler_overworld_yellow) with (shuff) move_left = true } else if (shuffle_direction == 1) { with (shuffler[current_shuffler]) move_left = true shuff = instance_position(130, 200, obj_snowdin_13_shuffler_overworld_yellow) with (shuff) move_right = true } } else if position_meeting(190, 200, shuffler[current_shuffler]) { with (shuffler[current_shuffler]) move_left = true shuff = instance_position(160, 200, obj_snowdin_13_shuffler_overworld_yellow) with (shuff) move_right = true } }
()
148
            break
149
        case 760:
150
        case 767:
151
        case 774:
152
        case 781:
153
        case 788:
154
        case 795:
155
        case 802:
156
        case 809:
157
        case 816:
158
        case 823:
159
        case 830:
160
        case 837:
161
        case 844:
162
        case 851:
163
        case 858:
164
        case 864:
165
            current_shuffler = irandom(2)
166
            scr_shuffle_snowdin_13_yellow
scr_shuffle_snowdin_13_yellow

function scr_shuffle_snowdin_13_yellow() //gml_Script_scr_shuffle_snowdin_13_yellow { var shuffle_direction = irandom(1) if position_meeting(130, 200, shuffler[current_shuffler]) { with (shuffler[current_shuffler]) move_right = true var shuff = instance_position(160, 200, obj_snowdin_13_shuffler_overworld_yellow) with (shuff) move_left = true } else if position_meeting(160, 200, shuffler[current_shuffler]) { if (shuffle_direction == 0) { with (shuffler[current_shuffler]) move_right = true shuff = instance_position(190, 200, obj_snowdin_13_shuffler_overworld_yellow) with (shuff) move_left = true } else if (shuffle_direction == 1) { with (shuffler[current_shuffler]) move_left = true shuff = instance_position(130, 200, obj_snowdin_13_shuffler_overworld_yellow) with (shuff) move_right = true } } else if position_meeting(190, 200, shuffler[current_shuffler]) { with (shuffler[current_shuffler]) move_left = true shuff = instance_position(160, 200, obj_snowdin_13_shuffler_overworld_yellow) with (shuff) move_right = true } }
()
167
            break
168
    }
169
170
    if (timer == 740 || timer == 847)
171
    {
172
        with (obj_snowdin_13_shuffler_overworld_yellow)
173
        {
174
            if (active == true)
175
                return;
176
        }
177
        timer = 300
178
    }
179
    if (timer == 300)
180
    {
181
        shufflers_select = true
182
        current_shuffler = 1
183
        shuffler[0] = instance_position(130, 200, obj_snowdin_13_shuffler_overworld_yellow)
184
        shuffler[1] = instance_position(160, 200, obj_snowdin_13_shuffler_overworld_yellow)
185
        shuffler[2] = instance_position(190, 200, obj_snowdin_13_shuffler_overworld_yellow)
186
    }
187
    if (timer > 302 && timer < 340)
188
    {
189
        with (shuffler[current_shuffler])
190
        {
191
            if (has_ball == true)
192
            {
193
                sprite_index = spr_shuffler_ball_overworld_yellow
194
                other.victory = true
195
            }
196
            else
197
            {
198
                sprite_index = spr_shuffler_noball_overworld_yellow
199
                other.victory = false
200
            }
201
            if (image_index == (image_number - 1))
202
            {
203
                image_speed = 0
204
                image_index = image_number - 1
205
            }
206
            else
207
                image_speed = 0.2
208
        }
209
    }
210
    if (timer == 340)
211
    {
212
        if (victory == true)
213
            audio_play_sound(snd_success, 20, 0)
214
        else
215
            audio_play_sound(snd_hurt, 20, 0)
216
    }
217
    if (timer >= 340 && timer < 380)
218
    {
219
        with (shuffler[current_shuffler])
220
        {
221
            if (floor(image_index) == 0)
222
            {
223
                image_index = 0
224
                image_speed = 0
225
            }
226
            else
227
                image_speed = -0.2
228
        }
229
    }
230
    if (timer == 379)
231
    {
232
        scr_audio_fade
scr_audio_fade

function scr_audio_fade(argument0, argument1) //gml_Script_scr_audio_fade { var snd = argument0 var fade_len = argument1 with (obj_radio) { audio_other_fade = true audio_to_fade = snd audio_fade_length = fade_len } }
(shuffle_music, 500)
233
        if (victory == true)
234
        {
235
            if (shufflers_round == 3)
236
            {
237
                shufflers_win = true
238
                timer = 420
239
                audio_stop_sound(shuffle_music)
240
            }
241
            else if (shufflers_round == 1)
242
            {
243
                timer++
244
                scr_text
scr_text

function scr_text() //gml_Script_scr_text { if (!instance_exists(obj_dialogue)) msg = instance_create(x, y, obj_dialogue) }
()
245
                with (msg)
246
                {
247
                    portrait = false
248
                    message[0] = "* Nice eye, kid."
249
                    message[1] = "* Keep it up."
250
                }
251
            }
252
            else if (shufflers_round == 2)
253
            {
254
                timer++
255
                scr_text
scr_text

function scr_text() //gml_Script_scr_text { if (!instance_exists(obj_dialogue)) msg = instance_create(x, y, obj_dialogue) }
()
256
                with (msg)
257
                {
258
                    portrait = false
259
                    message[0] = "* You're doin' good, kid."
260
                    message[1] = "* Now don't let it go to#  ya head."
261
                }
262
            }
263
        }
264
        else
265
        {
266
            failure = true
267
            shufflers_failsafe += 1
268
            shufflers_select = false
269
            shufflers_round = 1
270
            global.snowdin_flag[8] = 3
271
            timer = 382
272
        }
273
    }
274
    else if (timer == 380)
275
    {
276
        if (!instance_exists(obj_dialogue))
277
        {
278
            timer = 89
279
            victory = false
280
            shufflers_round++
281
            with (obj_snowdin_13_shuffler_overworld_yellow)
282
            {
283
                if (other.shufflers_round > 1)
284
                    shuffle_speed = 6
285
            }
286
        }
287
    }
288
    if (timer < 460 && (failure == true || shufflers_win == true))
289
    {
290
        if (timer >= 435)
291
        {
292
            with (obj_snowdin_13_rephil)
293
            {
294
                if (image_alpha != 1)
295
                {
296
                    image_alpha = 1
297
                    instance_destroy(instance_position(x, y, obj_snowdin_13_shuffler_overworld_yellow))
298
                    image_index = image_number - 1
299
                    image_speed = -0.5
300
                }
301
                else if (image_index == 0)
302
                {
303
                    image_speed = 0
304
                    image_index = 0
305
                    sprite_index = spr_rephil_overworld_yellow
306
                }
307
            }
308
        }
309
        if (timer >= 421)
310
        {
311
            with (obj_snowdin_13_swig)
312
            {
313
                if (image_alpha != 1)
314
                {
315
                    image_alpha = 1
316
                    instance_destroy(instance_position(x, y, obj_snowdin_13_shuffler_overworld_yellow))
317
                    image_index = image_number - 1
318
                    image_speed = -0.5
319
                }
320
                else if (image_index == 0)
321
                {
322
                    image_speed = 0
323
                    image_index = 0
324
                    sprite_index = spr_swig_overworld_yellow
325
                }
326
            }
327
        }
328
        if (timer == 450)
329
        {
330
            with (obj_snowdin_13_toast)
331
            {
332
                if (image_alpha != 1)
333
                {
334
                    image_alpha = 1
335
                    instance_destroy(instance_position(x, y, obj_snowdin_13_shuffler_overworld_yellow))
336
                    image_index = image_number - 1
337
                    image_speed = -0.5
338
                }
339
                else if (image_index == 0)
340
                {
341
                    image_speed = 0
342
                    image_index = 0
343
                    sprite_index = spr_toast_overworld_yellow
344
                    if (other.failure == true)
345
                        other.shufflers_puzzle = false
346
                    else if (other.shufflers_win == true)
347
                    {
348
                        audio_play_sound(mus_occupied_turf_yellow, 1, 1)
349
                        global.snowdin_flag[8] = 4
350
                        other.shufflers_puzzle = false
351
                    }
352
                    other.timer++
353
                }
354
            }
355
        }
356
    }
357
    if (timer <= 300 || (timer >= 302 && timer < 380) || (timer >= 382 && timer < 450) || timer > 500)
358
        timer++
359
}