Deltarune (Chapter 1) script viewer

← back to main script listing

gml_Object_obj_thrashcontroller_Step_0

(view raw script w/o annotations or w/e)
1
if (con == 0)
2
{
3
    if (logocon == 2)
4
    {
5
        introtimer += 1;
6
        if (introtimer >= 180)
7
            con = 1;
8
    }
9
}
10
if (con == 1)
11
{
12
    with (thrash)
13
    {
14
        if (a < 1)
15
            a += 0.1;
16
    }
17
    if (thrash.a >= 1)
18
        con = 2;
19
}
20
if (con == 2)
21
{
22
    for (i = 0; i < 6; i += 1)
23
        stat[i] = 0;
24
    for (i = 0; i < 3; i += 1)
25
    {
26
        if (global.flag[220 + i] >= 0)
27
        {
28
            addstat1 = stat1[i][global.flag[220 + i]];
29
            addstat2 = stat2[i][global.flag[220 + i]];
30
            if (addstat1 < 6)
31
                stat[addstat1] += 1;
32
            if (addstat2 < 6)
33
                stat[addstat2] += 1;
34
        }
35
    }
36
    if (menu == 0)
37
    {
38
        if (left_p())
39
            menucoord1x = 0;
40
        if (right_p())
41
        {
42
            if (menucoord1y < 3)
43
                menucoord1x = 1;
44
        }
45
        if (up_p())
46
        {
47
            menucoord1y -= 1;
48
            if (menucoord1y < 0)
49
                menucoord1y = 0;
50
        }
51
        if (down_p())
52
        {
53
            menucoord1y += 1;
54
            if (menucoord1y >= 3 && menucoord1x == 1)
55
                menucoord1y = 2;
56
            if (menucoord1y >= 3)
57
                menucoord1y = 3;
58
        }
59
        if (buffer1 < 0 && button1_p())
60
        {
61
            buffer1 = 3;
62
            buffer2 = 3;
63
            if (menucoord1x == 0)
64
            {
65
                if (menucoord1y < 3)
66
                    menu = 4 + menucoord1y;
67
                if (menucoord1y == 3)
68
                {
69
                    if (global.flag[220 thrash_machine_head] >= 0 && global.flag[221 thrash_machine_body] >= 0 && global.flag[222 thrash_machine_shoe] >= 0)
70
                        menu = 7;
71
                }
72
            }
73
            if (menucoord1x == 1)
74
            {
75
                if (global.flag[220 + menucoord1y] >= 0)
76
                    menu = menucoord1y + 1;
77
            }
78
        }
79
    }
80
    if (menu >= 1 && menu <= 3)
81
    {
82
        press = 0;
83
        if (right_h())
84
        {
85
            press = 1;
86
            if (colorbuffer == 0)
87
                global.flag[222 + menu] += 1;
88
            colorbuffer += 1;
89
            if (colorbuffer >= 3)
90
            {
91
                global.flag[222 + menu] += 1;
92
                colorbuffer = 1;
93
            }
94
        }
95
        if (left_h())
96
        {
97
            press = 1;
98
            if (colorbuffer == 0)
99
                global.flag[222 + menu] -= 1;
100
            colorbuffer += 1;
101
            if (colorbuffer >= 3)
102
            {
103
                global.flag[222 + menu] -= 1;
104
                colorbuffer = 1;
105
            }
106
        }
107
        if (press == 0)
108
            colorbuffer = 0;
109
        if (global.flag[222 + menu] > 31)
110
            global.flag[222 + menu] = 0;
111
        if (global.flag[222 + menu] < 0)
112
            global.flag[222 + menu] = 31;
113
        press = 0;
114
        if (button1_p() && buffer1 < 0)
115
            press = 1;
116
        if (button2_p() && buffer2 < 0)
117
            press = 1;
118
        if (press == 1)
119
        {
120
            menu = 0;
121
            buffer2 = 3;
122
            buffer1 = 3;
123
        }
124
    }
125
    if (menu >= 4 && menu <= 6)
126
    {
127
        tm = menu - 4;
128
        global.flag[216 + menu] = menucoord2[tm];
129
        if (up_p())
130
        {
131
            if (menucoord2[tm] > 0)
132
                menucoord2[tm] -= 1;
133
        }
134
        if (down_p())
135
        {
136
            if (menucoord2[tm] < 3)
137
                menucoord2[tm] += 1;
138
        }
139
        press = 0;
140
        if (button1_p() && buffer1 < 0)
141
            press = 1;
142
        if (button2_p() && buffer2 < 0)
143
            press = 1;
144
        if (press == 1)
145
        {
146
            menu = 0;
147
            buffer2 = 3;
148
            buffer1 = 3;
149
        }
150
    }
151
    if (menu == 7)
152
    {
153
        if (right_p() || left_p())
154
        {
155
            if (endcoord == 0)
156
                endcoord = 1;
157
            else
158
                endcoord = 0;
159
        }
160
        quit = 0;
161
        if (button1_p() && buffer1 < 0)
162
        {
163
            buffer1 = 3;
164
            buffer2 = 3;
165
            if (endcoord == 0)
166
            {
167
                if (instance_exists(obj_thrashmaker_event))
168
                {
169
                    for (i = 0; i < 6; i += 1)
170
                        obj_thrashmaker_event.stat[i] = stat[i];
171
                }
172
                snd_volume(global.currentsong[1], 0, 40);
173
                ctimer = 0;
174
                menu = -1;
175
                ended = 1;
176
                con = 5;
177
            }
178
            else
179
            {
180
                quit = 1;
181
            }
182
        }
183
        if (button2_p() && buffer2 < 0)
184
        {
185
            buffer2 = 3;
186
            buffer1 = 3;
187
            quit = 1;
188
        }
189
        if (quit == 1)
190
            menu = 0;
191
    }
192
}
193
if (con == 5)
194
{
195
    with (thrash)
196
        a -= 0.03;
197
    logocon = 3;
198
    ctimer += 1;
199
    if (ctimer >= 40)
200
    {
201
        with (thrash)
202
            instance_destroy();
203
        instance_destroy();
204
    }
205
}
206
buffer1 -= 1;
207
buffer2 -= 1;
208
for (i = 0; i < 3; i += 1)
209
{
210
    mtxt[i] = 
(SELECT)
scr_84_get_lang_string
scr_84_get_lang_string

function
scr_84_get_lang_string(arg0)
{ return ds_map_find_value(global.lang_map, arg0); }
("obj_thrashcontroller_slash_Step_0_gml_259_0")
;
211
    if (global.flag[220 + i] >= 0)
212
        mtxt[i] = menutext2[i][global.flag[220 + i]];
213
}
214
menutext1[0][0] = 
HEAD:
scr_84_get_lang_string
scr_84_get_lang_string

function
scr_84_get_lang_string(arg0)
{ return ds_map_find_value(global.lang_map, arg0); }
("obj_thrashcontroller_slash_Step_0_gml_264_0")
+ mtxt[0];
215
menutext1[0][1] = 
BODY:
scr_84_get_lang_string
scr_84_get_lang_string

function
scr_84_get_lang_string(arg0)
{ return ds_map_find_value(global.lang_map, arg0); }
("obj_thrashcontroller_slash_Step_0_gml_265_0")
+ mtxt[1];
216
menutext1[0][2] = 
SHOE:
scr_84_get_lang_string
scr_84_get_lang_string

function
scr_84_get_lang_string(arg0)
{ return ds_map_find_value(global.lang_map, arg0); }
("obj_thrashcontroller_slash_Step_0_gml_266_0")
+ mtxt[2];