Undertale Yellow script viewer

← back to main script listing

gml_GlobalScript_scr_text_choices

(view raw script w/o annotations or w/e)
1
function scr_text_choices
scr_text_choices

function scr_text_choices() //gml_Script_scr_text_choices { if live_call() return global.live_result; if variable_instance_exists(id, "ch_delay") { if (ch_delay > 0) { ch_delay-- return; } else ch_delay = -1 } if (variable_instance_exists(id, "ch_alpha") && variable_instance_exists(id, "alpha_fade")) { if (variable_instance_exists(id, "alpha_fade_out") && alpha_fade_out == true) { if (ch_alpha > 0.01) { ch_alpha = lerp(ch_alpha, 0, 0.2) return; } else { ch_alpha = 0 outcome = p choice = false alpha_fade_out = false alpha_fade = false } } else if (alpha_fade == true) { if (ch_alpha < 0.99) ch_alpha = lerp(ch_alpha, 1, 0.15) else ch_alpha = 1 if (ch_alpha < 0.75) return; } } if (outcome == p && choice == false) { if ((message_current + 1) < array_length_1d(message)) { message_current += 1 cutoff = 0 } else global.dialogue_open = false outcome = 0 } if (message_current == ch_msg) choice = true if (choice == true && cutoff >= string_length(message[message_current])) { switch p { case 1: if (global.right_keyp && ch[2] != "") p = 2 if (global.down_keyp && ch[3] != "") p = 3 break case 2: if global.left_keyp p = 1 if global.down_keyp { if (ch[4] != "") p = 4 else if (ch[3] != "") p = 3 } break case 3: if (global.right_keyp && ch[4] != "") p = 4 if global.up_keyp p = 1 break case 4: if global.up_keyp p = 2 if global.left_keyp p = 3 break } if (ch[2] != "" && (global.right_keyp || global.down_keyp || global.up_keyp || global.left_keyp)) audio_play_sound(snd_mainmenu_select, 1, 0) if keyboard_multicheck_pressed(0) { if (variable_instance_exists(id, "alpha_fade") && alpha_fade == true) alpha_fade_out = true else { outcome = p choice = false } ...
() //gml_Script_scr_text_choices
2
{
3
    if live_call()
4
        return global.live_result;
5
    if variable_instance_exists(id, "ch_delay")
6
    {
7
        if (ch_delay > 0)
8
        {
9
            ch_delay--
10
            return;
11
        }
12
        else
13
            ch_delay = -1
14
    }
15
    if (variable_instance_exists(id, "ch_alpha") && variable_instance_exists(id, "alpha_fade"))
16
    {
17
        if (variable_instance_exists(id, "alpha_fade_out") && alpha_fade_out == true)
18
        {
19
            if (ch_alpha > 0.01)
20
            {
21
                ch_alpha = lerp(ch_alpha, 0, 0.2)
22
                return;
23
            }
24
            else
25
            {
26
                ch_alpha = 0
27
                outcome = p
28
                choice = false
29
                alpha_fade_out = false
30
                alpha_fade = false
31
            }
32
        }
33
        else if (alpha_fade == true)
34
        {
35
            if (ch_alpha < 0.99)
36
                ch_alpha = lerp(ch_alpha, 1, 0.15)
37
            else
38
                ch_alpha = 1
39
            if (ch_alpha < 0.75)
40
                return;
41
        }
42
    }
43
    if (outcome == p && choice == false)
44
    {
45
        if ((message_current + 1) < array_length_1d(message))
46
        {
47
            message_current += 1
48
            cutoff = 0
49
        }
50
        else
51
            global.dialogue_open = false
52
        outcome = 0
53
    }
54
    if (message_current == ch_msg)
55
        choice = true
56
    if (choice == true && cutoff >= string_length(message[message_current]))
57
    {
58
        switch p
59
        {
60
            case 1:
61
                if (global.right_keyp && ch[2] != "")
62
                    p = 2
63
                if (global.down_keyp && ch[3] != "")
64
                    p = 3
65
                break
66
            case 2:
67
                if global.left_keyp
68
                    p = 1
69
                if global.down_keyp
70
                {
71
                    if (ch[4] != "")
72
                        p = 4
73
                    else if (ch[3] != "")
74
                        p = 3
75
                }
76
                break
77
            case 3:
78
                if (global.right_keyp && ch[4] != "")
79
                    p = 4
80
                if global.up_keyp
81
                    p = 1
82
                break
83
            case 4:
84
                if global.up_keyp
85
                    p = 2
86
                if global.left_keyp
87
                    p = 3
88
                break
89
        }
90
91
        if (ch[2] != "" && (global.right_keyp || global.down_keyp || global.up_keyp || global.left_keyp))
92
            audio_play_sound(snd_mainmenu_select, 1, 0)
93
        if keyboard_multicheck_pressed(0)
94
        {
95
            if (variable_instance_exists(id, "alpha_fade") && alpha_fade == true)
96
                alpha_fade_out = true
97
            else
98
            {
99
                outcome = p
100
                choice = false
101
            }
102
            audio_play_sound(snd_confirm, 1, 0)
103
        }
104
    }
105
}