Deltarune (Chapter 4) script viewer

← back to main script listing

gml_Object_obj_credits_ch4_Step_0

related scripts: Create_0Draw_0Step_0

(view raw script w/o annotations or w/e)
1
if (!loaded)
2
    exit;
3
if (
scr_debug
scr_debug

function
scr_debug()
{ if (global.debug == 1) return 1; }
())
4
{
5
    if (sunkus_kb_check_pressed(ord("R")))
6
    {
7
        snd_free_all();
8
        room_restart();
9
    }
10
    if (sunkus_kb_check_pressed(ord("Q")))
11
        audio_sound_set_track_position(song1, audio_sound_get_track_position(song1) + measure_time);
12
    if (sunkus_kb_check_pressed(vk_space))
13
    {
14
        if (!paused)
15
        {
16
            paused = true;
17
            audio_pause_all();
18
        }
19
        else
20
        {
21
            paused = false;
22
            audio_resume_all();
23
        }
24
    }
25
}
26
if (!init)
27
{
28
    init = true;
29
    snd_free_all();
30
    song0 = snd_init("ch4_credits.ogg");
31
    song1 = mus_play(song0);
32
}
33
timer++;
34
if (audio_is_playing(song1))
35
{
36
    var timer_progress = timer / (audio_sound_length(song1) * 30);
37
    var sync_amount = timer_progress - (audio_sound_get_track_position(song1) / audio_sound_length(song1));
38
    if (sync_amount >= 0.03)
39
        audio_sound_set_track_position(song1, audio_sound_length(song1) * timer_progress);
40
}
41
if (credits_con == 0)
42
{
43
    if (credit_index < (array_length(credits) - 1))
44
    {
45
        if (audio_is_playing(song1))
46
        {
47
            var track_progress = audio_sound_get_track_position(song1);
48
            if (track_progress < measure_timer)
49
                exit;
50
            var measure_progress = track_progress / measure_time;
51
            credit_index = floor(measure_progress) - 1;
52
        }
53
    }
54
    else
55
    {
56
        credits_con = 1;
57
        glowing_active = true;
58
    }
59
}
60
if (credits_con == 1)
61
{
62
    var track_progress = audio_sound_get_track_position(song1);
63
    if (track_progress >= 59.75)
64
    {
65
        creditalpha = 0;
66
        credits_con = -1;
67
    }
68
}
69
if (glowing_active)
70
{
71
    if (con == 0)
72
    {
73
        con = 1;
74
        auto_text = true;
75
    }
76
    if (con == 50 && !i_ex(obj_writer))
77
    {
78
        con = 51;
79
        scr_delay_var("con", 52, 30);
80
    }
81
    if (con == 52 && !i_ex(obj_writer))
82
    {
83
        con = 53;
84
        scr_delay_var("con", 54, 90);
85
        credit_index++;
86
        creditalpha = 1;
87
        
scr_lerpvar
scr_lerpvar

function
scr_lerpvar()
{ if (argument_count < 6) ___lerpvar =
scr_lerpvar_instance(id, argument[0], argument[1], argument[2], argument[3]);
else ___lerpvar =
scr_lerpvar_instance(id, argument[0], argument[1], argument[2], argument[3], argument[4], argument[5]);
return ___lerpvar; } function scr_lerpvar_respect() { if (argument_count < 6) ___lerpvar =
scr_lerpvar_instance(id, argument[0], argument[1], argument[2], argument[3]);
else ___lerpvar =
scr_lerpvar_instance(id, argument[0], argument[1], argument[2], argument[3], argument[4], argument[5]);
___lerpvar.respectglobalinteract = true; return ___lerpvar; }
("year_alpha", -1, 1, 30);
88
    }
89
    if (con == 54)
90
    {
91
        con = -1;
92
        scr_delay_var("con", 55, 90);
93
        
scr_lerpvar
scr_lerpvar

function
scr_lerpvar()
{ if (argument_count < 6) ___lerpvar =
scr_lerpvar_instance(id, argument[0], argument[1], argument[2], argument[3]);
else ___lerpvar =
scr_lerpvar_instance(id, argument[0], argument[1], argument[2], argument[3], argument[4], argument[5]);
return ___lerpvar; } function scr_lerpvar_respect() { if (argument_count < 6) ___lerpvar =
scr_lerpvar_instance(id, argument[0], argument[1], argument[2], argument[3]);
else ___lerpvar =
scr_lerpvar_instance(id, argument[0], argument[1], argument[2], argument[3], argument[4], argument[5]);
___lerpvar.respectglobalinteract = true; return ___lerpvar; }
("year_alpha", 1, 0, 30);
94
    }
95
    if (con == 55 && !i_ex(obj_writer))
96
    {
97
        if (audio_is_playing(song1))
98
        {
99
            var track_progress = audio_sound_get_track_position(song1);
100
            var measure_progress = track_progress / measure_time;
101
            var current_measure = floor(measure_progress);
102
            if (current_measure == 26)
103
            {
104
                con = 60;
105
                creditalpha = 0;
106
            }
107
        }
108
        else
109
        {
110
            con = 60;
111
            creditalpha = 0;
112
        }
113
    }
114
    if (con == 60)
115
    {
116
        con = -1;
117
        room_goto(room_chapter_continue);
118
    }
119
    if (auto_text)
120
    {
121
        if (audio_is_playing(song1))
122
        {
123
            var track_progress = audio_sound_get_track_position(song1);
124
            if (track_progress >= auto_text_start)
125
            {
126
                if (!i_ex(obj_writer))
127
                {
128
                    if (glowing_index < array_length(glowing_text))
129
                    {
130
                        dequeue_text();
131
                    }
132
                    else
133
                    {
134
                        auto_text = false;
135
                        con = 50;
136
                    }
137
                }
138
            }
139
            if (track_progress >= auto_text_stop)
140
            {
141
                with (obj_writer)
142
                    forcebutton1 = 1;
143
            }
144
            with (obj_writer)
145
                skippable = 0;
146
        }
147
    }
148
}