Deltarune (Chapter 3) 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) 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_tv_voice_short) { var rand = irandom(8) + 1; if (global.flag[1054 tenna_voice_pitch] <= 0) global.flag[1054 tenna_voice_pitch] = 1; var pitchrandom = (0.86 + random(0.35)) * global.flag[1054 tenna_voice_pitch]; var soundindex = "snd_tv_voice_short"; if (rand >= 2) soundindex += ("_" + string(rand)); soundindex = asset_get_index(soundindex); audio_stop_sound(snd_tv_voice_short); audio_stop_sound(snd_tv_voice_short_2); audio_stop_sound(snd_tv_voice_short_3); audio_stop_sound(snd_tv_voice_short_4); audio_stop_sound(snd_tv_voice_short_5); audio_stop_sound(snd_tv_voice_short_6); audio_stop_sound(snd_tv_voice_short_7); audio_stop_sound(snd_tv_voice_short_8); audio_stop_sound(snd_tv_voice_short_9); snd_play_x(soundindex, 0.7, pitchrandom); sound_timer = 3; } else { snd_play(textsound); } with (obj_face_parent) mouthmove = 1; miniface_pos++; } ...
()
2
{
3
    playtextsound = 1;
4
    if (button2_h() == 1)
5
        playtextsound = 0;
6
    if (skippable == 0)
7
        playtextsound = 1;
8
    if (playtextsound == 1)
9
    {
10
        if (rate <= 2)
11
            getchar = string_char_at(mystring, pos);
12
        else
13
            getchar = string_char_at(mystring, pos - 1);
14
        play = 1;
15
        playcheck = 0;
16
        if (getchar == "&" || getchar == "\n")
17
        {
18
            if (rate < 3)
19
            {
20
                playcheck = 1;
21
                getchar = string_char_at(mystring, pos + 1);
22
            }
23
            else
24
            {
25
                play = 0;
26
            }
27
        }
28
        if (getchar == " ")
29
            play = 0;
30
        if (getchar == "^")
31
            play = 0;
32
        if (getchar == "!")
33
            play = 0;
34
        if (getchar == ".")
35
            play = 0;
36
        if (getchar == "?")
37
            play = 0;
38
        if (getchar == ",")
39
            play = 0;
40
        if (getchar == ":")
41
            play = 0;
42
        if (getchar == "/")
43
            play = 0;
44
        if (getchar == "\\")
45
            play = 0;
46
        if (getchar == "|")
47
            play = 0;
48
        if (getchar == "*")
49
            play = 0;
50
        if (play == 1)
51
        {
52
            if (textsound == snd_txtq)
53
            {
54
                audio_stop_sound(snd_txtq_2);
55
                qv = snd_play(snd_txtq_2);
56
                qp = 0.9 + random(0.15);
57
                snd_pitch(qv, qp);
58
                sound_timer = 2;
59
            }
60
            else if (textsound == snd_txtspam)
61
            {
62
                audio_stop_sound(snd_txtspam2);
63
                snd_play_x(snd_txtspam2, 0.8, 1.2);
64
                sound_timer = 2;
65
            }
66
            else if (textsound == snd_txtsans)
67
            {
68
                audio_stop_sound(snd_txtsans);
69
                qv = snd_play(snd_txtsans);
70
                sound_timer = 2;
71
            }
72
            else if (textsound == snd_tv_voice_short)
73
            {
74
                var rand = irandom(8) + 1;
75
                if (global.flag[1054 tenna_voice_pitch] <= 0)
76
                    global.flag[1054 tenna_voice_pitch] = 1;
77
                var pitchrandom = (0.86 + random(0.35)) * global.flag[1054 tenna_voice_pitch];
78
                var soundindex = "snd_tv_voice_short";
79
                if (rand >= 2)
80
                    soundindex += ("_" + string(rand));
81
                soundindex = asset_get_index(soundindex);
82
                audio_stop_sound(snd_tv_voice_short);
83
                audio_stop_sound(snd_tv_voice_short_2);
84
                audio_stop_sound(snd_tv_voice_short_3);
85
                audio_stop_sound(snd_tv_voice_short_4);
86
                audio_stop_sound(snd_tv_voice_short_5);
87
                audio_stop_sound(snd_tv_voice_short_6);
88
                audio_stop_sound(snd_tv_voice_short_7);
89
                audio_stop_sound(snd_tv_voice_short_8);
90
                audio_stop_sound(snd_tv_voice_short_9);
91
                snd_play_x(soundindex, 0.7, pitchrandom);
92
                sound_timer = 3;
93
            }
94
            else
95
            {
96
                snd_play(textsound);
97
            }
98
            with (obj_face_parent)
99
                mouthmove = 1;
100
            miniface_pos++;
101
        }
102
    }
103
}