Deltarune (Chapter 5) script viewer

← back to main script listing

gml_GlobalScript_scr_textsound

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

function
scr_textsound()
{ playtextsound = 1; if (button2_h() == 1) { var dontplaysound = true; if (variable_instance_exists(id, "runcheck")) { if (runcheck) dontplaysound = false; } if (dontplaysound) playtextsound = 0; } if (skippable == 0) playtextsound = 1; if (playtextsound == 1) { if (rate <= 2) getchar = string_char_at(mystring, pos); else getchar = string_char_at(mystring, pos - 1); play = 1; playcheck = 0; if (getchar == "&" || getchar == "\n") { if (rate < 3) { playcheck = 1; getchar = string_char_at(mystring, pos + 1); } else { play = 0; } } if (getchar == " ") play = 0; if (getchar == "^") play = 0; if (getchar == "!") play = 0; if (getchar == ".") play = 0; if (getchar == "?") play = 0; if (getchar == ",") play = 0; if (getchar == ":") play = 0; if (getchar == "/") play = 0; if (getchar == "\\") play = 0; if (getchar == "|") play = 0; if (getchar == "*") play = 0; if (play == 1) { if (textsound == snd_txtq) { audio_stop_sound(snd_txtq_2); qv = snd_play(snd_txtq_2); qp = 0.9 + random(0.15); snd_pitch(qv, qp); sound_timer = 2; } else if (textsound == snd_txtspam) { audio_stop_sound(snd_txtspam2); snd_play_x(snd_txtspam2, 0.8, 1.2); sound_timer = 2; } else if (textsound == snd_txtsans) { audio_stop_sound(snd_txtsans); qv = snd_play(snd_txtsans); sound_timer = 2; } else if (textsound == snd_flowery_voicenoise_1) { if (global.voiceclipmode == 0) sound_timer = 1; if (global.voiceclipmode == 1) { if (!snd_is_playing(global.voiceclip)) snd_play(global.voiceclip); sound_timer = 1; } if (global.voiceclipmode == 2) { audio_stop_sound(snd_flowery_voicenoise_1); audio_stop_sound(snd_flowery_voicenoise_2); audio_stop_sound(snd_flowery_voicenoise_3); qv = snd_play_x(choose(snd_flowery_voicenoise_1, snd_flowery_voicenoise_2, snd_flowery_voicenoise_3), 1, 0.9 + random(0.15)); sound_timer = 3; } } else if (textsound == snd_flowery_voicenoise_loop) { ...
()
2
{
3
    playtextsound = 1;
4
    if (button2_h() == 1)
5
    {
6
        var dontplaysound = true;
7
        if (variable_instance_exists(id, "runcheck"))
8
        {
9
            if (runcheck)
10
                dontplaysound = false;
11
        }
12
        if (dontplaysound)
13
            playtextsound = 0;
14
    }
15
    if (skippable == 0)
16
        playtextsound = 1;
17
    if (playtextsound == 1)
18
    {
19
        if (rate <= 2)
20
            getchar = string_char_at(mystring, pos);
21
        else
22
            getchar = string_char_at(mystring, pos - 1);
23
        play = 1;
24
        playcheck = 0;
25
        if (getchar == "&" || getchar == "\n")
26
        {
27
            if (rate < 3)
28
            {
29
                playcheck = 1;
30
                getchar = string_char_at(mystring, pos + 1);
31
            }
32
            else
33
            {
34
                play = 0;
35
            }
36
        }
37
        if (getchar == " ")
38
            play = 0;
39
        if (getchar == "^")
40
            play = 0;
41
        if (getchar == "!")
42
            play = 0;
43
        if (getchar == ".")
44
            play = 0;
45
        if (getchar == "?")
46
            play = 0;
47
        if (getchar == ",")
48
            play = 0;
49
        if (getchar == ":")
50
            play = 0;
51
        if (getchar == "/")
52
            play = 0;
53
        if (getchar == "\\")
54
            play = 0;
55
        if (getchar == "|")
56
            play = 0;
57
        if (getchar == "*")
58
            play = 0;
59
        if (play == 1)
60
        {
61
            if (textsound == snd_txtq)
62
            {
63
                audio_stop_sound(snd_txtq_2);
64
                qv = snd_play(snd_txtq_2);
65
                qp = 0.9 + random(0.15);
66
                snd_pitch(qv, qp);
67
                sound_timer = 2;
68
            }
69
            else if (textsound == snd_txtspam)
70
            {
71
                audio_stop_sound(snd_txtspam2);
72
                snd_play_x(snd_txtspam2, 0.8, 1.2);
73
                sound_timer = 2;
74
            }
75
            else if (textsound == snd_txtsans)
76
            {
77
                audio_stop_sound(snd_txtsans);
78
                qv = snd_play(snd_txtsans);
79
                sound_timer = 2;
80
            }
81
            else if (textsound == snd_flowery_voicenoise_1)
82
            {
83
                if (global.voiceclipmode == 0)
84
                    sound_timer = 1;
85
                if (global.voiceclipmode == 1)
86
                {
87
                    if (!snd_is_playing(global.voiceclip))
88
                        snd_play(global.voiceclip);
89
                    sound_timer = 1;
90
                }
91
                if (global.voiceclipmode == 2)
92
                {
93
                    audio_stop_sound(snd_flowery_voicenoise_1);
94
                    audio_stop_sound(snd_flowery_voicenoise_2);
95
                    audio_stop_sound(snd_flowery_voicenoise_3);
96
                    qv = snd_play_x(choose(snd_flowery_voicenoise_1, snd_flowery_voicenoise_2, snd_flowery_voicenoise_3), 1, 0.9 + random(0.15));
97
                    sound_timer = 3;
98
                }
99
            }
100
            else if (textsound == snd_flowery_voicenoise_loop)
101
            {
102
                if (global.voiceclipmode == 0)
103
                    sound_timer = 1;
104
                if (global.voiceclipmode == 1)
105
                {
106
                    if (!snd_is_playing(global.voiceclip))
107
                        snd_play(global.voiceclip);
108
                    sound_timer = 1;
109
                }
110
                if (global.voiceclipmode == 2)
111
                {
112
                    audio_stop_sound(snd_flowery_voicenoise_loop);
113
                    snd_play_x(snd_flowery_voicenoise_loop, 1, 0.94);
114
                    sound_timer = 3;
115
                }
116
            }
117
            else if (textsound == snd_tv_voice_short)
118
            {
119
                var rand = irandom(8) + 1;
120
                if (global.flag[1054 tenna_voice_pitch] <= 0)
121
                    global.flag[1054 tenna_voice_pitch] = 1;
122
                var pitchrandom = (0.86 + random(0.35)) * global.flag[1054 tenna_voice_pitch];
123
                var soundindex = "snd_tv_voice_short";
124
                if (rand >= 2)
125
                    soundindex += ("_" + string(rand));
126
                soundindex = asset_get_index(soundindex);
127
                audio_stop_sound(snd_tv_voice_short);
128
                audio_stop_sound(snd_tv_voice_short_2);
129
                audio_stop_sound(snd_tv_voice_short_3);
130
                audio_stop_sound(snd_tv_voice_short_4);
131
                audio_stop_sound(snd_tv_voice_short_5);
132
                audio_stop_sound(snd_tv_voice_short_6);
133
                audio_stop_sound(snd_tv_voice_short_7);
134
                audio_stop_sound(snd_tv_voice_short_8);
135
                audio_stop_sound(snd_tv_voice_short_9);
136
                snd_play_x(soundindex, 0.7, pitchrandom);
137
                sound_timer = 3;
138
            }
139
            else if (textsound == snd_txtnoe)
140
            {
141
                if (room == room_beach)
142
                {
143
                    if (i_ex(obj_ch5_LW20W_handoff) && obj_ch5_LW20W_handoff.failed == false)
144
                    {
145
                        var pitch = 1;
146
                        with (obj_ch5_LW20W_handoff)
147
                            pitch = random_range(lowpitch, highpitch);
148
                        snd_play(textsound, 1, pitch);
149
                    }
150
                    else if (i_ex(obj_ch5_LW20W))
151
                    {
152
                        var max_pitch = obj_ch5_LW20W.voice_pitch;
153
                        if (max_pitch > 0)
154
                        {
155
                            var pitchrandom = random(max_pitch);
156
                            snd_play_x(textsound, 1, 1 + pitchrandom);
157
                        }
158
                        else
159
                        {
160
                            snd_play(textsound);
161
                        }
162
                    }
163
                    else
164
                    {
165
                        snd_play(textsound);
166
                    }
167
                }
168
                else if (room == room_krisroom)
169
                {
170
                    audio_stop_sound(snd_txtnoe_echo);
171
                    snd_play(snd_txtnoe_echo);
172
                }
173
                else
174
                {
175
                    snd_play(textsound);
176
                }
177
            }
178
            else
179
            {
180
                snd_play(textsound);
181
            }
182
            with (obj_face_parent)
183
                mouthmove = 1;
184
            miniface_pos++;
185
        }
186
    }
187
}