Deltarune (Chapter 4) 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_txtjack_high_cute || textsound == snd_txtjack_low2) { if (textsound == snd_txtjack_high_cute) { audio_stop_sound(snd_txtjack_high_cute); qv = snd_play(snd_txtjack_high_cute); qp = 0.75 + random(0.5); snd_pitch(qv, qp); sound_timer = 3; } if (textsound == snd_txtjack_low2) { audio_stop_sound(snd_txtjack_low2); qv = snd_play(snd_txtjack_low2); qp = 0.75 + random(0.5); snd_pitch(qv, qp); sound_timer = 3; } } else if (textsound == snd_txger) { ...
()
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_txtjack_high_cute || textsound == snd_txtjack_low2)
82
            {
83
                if (textsound == snd_txtjack_high_cute)
84
                {
85
                    audio_stop_sound(snd_txtjack_high_cute);
86
                    qv = snd_play(snd_txtjack_high_cute);
87
                    qp = 0.75 + random(0.5);
88
                    snd_pitch(qv, qp);
89
                    sound_timer = 3;
90
                }
91
                if (textsound == snd_txtjack_low2)
92
                {
93
                    audio_stop_sound(snd_txtjack_low2);
94
                    qv = snd_play(snd_txtjack_low2);
95
                    qp = 0.75 + random(0.5);
96
                    snd_pitch(qv, qp);
97
                    sound_timer = 3;
98
                }
99
            }
100
            else if (textsound == snd_txger)
101
            {
102
                audio_stop_sound(snd_txger);
103
                var sndpitch = choose(1, 1, 1 - random(0.2));
104
                var snd = choose(82);
105
                qv = snd_play(snd, 1, sndpitch);
106
                sound_timer = 3;
107
            }
108
            else if (textsound == snd_tv_voice_short)
109
            {
110
                var rand = irandom(8) + 1;
111
                if (global.flag[1054 tenna_voice_pitch] <= 0)
112
                    global.flag[1054 tenna_voice_pitch] = 1;
113
                var pitchrandom = (0.86 + random(0.35)) * global.flag[1054 tenna_voice_pitch];
114
                var soundindex = "snd_tv_voice_short";
115
                if (rand >= 2)
116
                    soundindex += ("_" + string(rand));
117
                soundindex = asset_get_index(soundindex);
118
                audio_stop_sound(snd_tv_voice_short);
119
                audio_stop_sound(snd_tv_voice_short_2);
120
                audio_stop_sound(snd_tv_voice_short_3);
121
                audio_stop_sound(snd_tv_voice_short_4);
122
                audio_stop_sound(snd_tv_voice_short_5);
123
                audio_stop_sound(snd_tv_voice_short_6);
124
                audio_stop_sound(snd_tv_voice_short_7);
125
                audio_stop_sound(snd_tv_voice_short_8);
126
                audio_stop_sound(snd_tv_voice_short_9);
127
                snd_play_x(soundindex, 0.7, pitchrandom);
128
                sound_timer = 3;
129
            }
130
            else if (textsound == snd_txtral)
131
            {
132
                if (global.chapter == 4)
133
                {
134
                    if (room == room_dw_churchb_nongerson_post)
135
                    {
136
                        if (i_ex(obj_ch4_DCB02))
137
                        {
138
                            var max_pitch = obj_ch4_DCB02.voice_pitch;
139
                            if (max_pitch > 0)
140
                            {
141
                                var pitchrandom = random(max_pitch);
142
                                snd_play_x(textsound, 1, 1 + pitchrandom);
143
                            }
144
                            else
145
                            {
146
                                snd_play(textsound);
147
                            }
148
                        }
149
                    }
150
                    else
151
                    {
152
                        snd_play(textsound);
153
                    }
154
                }
155
                else
156
                {
157
                    snd_play(textsound);
158
                }
159
            }
160
            else
161
            {
162
                snd_play(textsound);
163
            }
164
            with (obj_face_parent)
165
                mouthmove = 1;
166
            miniface_pos++;
167
        }
168
    }
169
}