Undertale Yellow script viewer

← back to main script listing

gml_Object_obj_factory_numpad_overlay_Step_0

(view raw script w/o annotations or w/e)
1
if live_call()
2
    return global.live_result;
3
if (entry_correct != -1)
4
{
5
    if layer_sequence_is_paused(overlay_sequence)
6
        layer_sequence_play(overlay_sequence)
7
    if layer_sequence_is_finished(overlay_sequence)
8
    {
9
        layer_sequence_destroy(overlay_sequence)
10
        instance_destroy()
11
    }
12
    return;
13
}
14
if global.left_keyp
15
{
16
    if ((number_selected > 1 && number_selected < 4) || (number_selected > 4 && number_selected < 7) || (number_selected > 7 && number_selected < 11))
17
        number_selected -= 1
18
    else
19
        number_selected += 2
20
    audio_play_sound(snd_mainmenu_select, 1, 0)
21
}
22
if global.right_keyp
23
{
24
    if ((number_selected < 3 && number_selected > 0) || (number_selected < 6 && number_selected > 3) || (number_selected < 9 && number_selected > 6))
25
        number_selected += 1
26
    else
27
        number_selected -= 2
28
    audio_play_sound(snd_mainmenu_select, 1, 0)
29
}
30
if global.down_keyp
31
{
32
    if (number_selected < 10)
33
        number_selected = clamp((number_selected + 3), 1, 10)
34
    else
35
        number_selected = 2
36
    audio_play_sound(snd_mainmenu_select, 1, 0)
37
}
38
if global.up_keyp
39
{
40
    if (number_selected > 3)
41
        number_selected = clamp((number_selected - 3), 1, 10)
42
    else
43
        number_selected = 10
44
    audio_play_sound(snd_mainmenu_select, 1, 0)
45
}
46
var confirm = false
47
if instance_exists(obj_factory_03_numpad_number)
48
{
49
    with (obj_factory_03_numpad_number)
50
    {
51
        var current_number = image_index + 1
52
        if (current_number == other.number_selected)
53
        {
54
            active = true
55
            if keyboard_multicheck_pressed(0)
56
            {
57
                if (other.number_selected != 10)
58
                {
59
                    if ((!button_pressed) && string_length(other.entry_number) < 4)
60
                    {
61
                        audio_play_sound(snd_beep, 1, 0)
62
                       alarm[0]
63
                        other.entry_number += string(other.number_selected)
64
                        button_pressed = true
65
                    }
66
                }
67
                else
68
                    confirm = true
69
            }
70
        }
71
        else
72
            active = false
73
    }
74
}
75
if (confirm == true)
76
{
77
    if (entry_number == target_code)
78
    {
79
        entry_correct = 1
80
        audio_play_sound(snd_success, 1, 0)
81
    }
82
    else
83
    {
84
        entry_correct = 0
85
        audio_play_sound(snd_fail, 1, 0)
86
    }
87
}