Deltarune (Chapter 3) script viewer

← back to main script listing

gml_Object_obj_board_event_lawnmower_Step_0

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

function
scr_board_populatevars()
{ if (!variable_instance_exists(id, "kris")) kris = 0; if (!variable_instance_exists(id, "susie")) susie = 0; if (!variable_instance_exists(id, "ralsei")) ralsei = 0; if (kris == 0) { with (obj_mainchara_board) { if (name == "kris") other.kris = id; } } if (ralsei == 0) { with (obj_mainchara_board) { if (name == "ralsei") other.ralsei = id; } } if (susie == 0) { with (obj_mainchara_board) { if (name == "susie") other.susie = id; } } }
();
2
if (tenna == 0)
3
{
4
    with (obj_actor_tenna)
5
        other.tenna = id;
6
}
7
if (susiereal == 0)
8
{
9
    with (obj_caterpillarchara)
10
    {
11
        if (name == "susie")
12
            other.susiereal = id;
13
    }
14
}
15
if (ralseireal == 0)
16
{
17
    with (obj_caterpillarchara)
18
    {
19
        if (name == "ralsei")
20
            other.ralseireal = id;
21
    }
22
}
23
if (krisreal == 0)
24
{
25
    with (obj_mainchara)
26
        other.krisreal = id;
27
}
28
if (lawnmower == 0)
29
{
30
    with (obj_board_lawnmower)
31
        other.lawnmower = id;
32
}
33
if (active == 1 && obj_board_camera.con == 0)
34
{
35
    if (gamestart == 0 && global.flag[1022 tenna_board_absent] == 0)
36
    {
37
        if (obj_board_lawnmower.movingtimer > 0)
38
        {
39
            kris.cantleave = true;
40
            mus_fade(global.currentsong[1], 10);
41
            var lawnmusic_snd = snd_init("ch3_south_of_the_border.ogg");
42
            lawnmusic = mus_loop(lawnmusic_snd);
43
            
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; }
("scorey", scorey, 0, 10, 2, "out");
44
            gamestart = 1;
45
        }
46
    }
47
    if (tutcon == 0 && obj_board_camera.con == 0 && global.flag[1022 tenna_board_absent] == 0)
48
    {
49
        tuttimer++;
50
        if (tuttimer == 1)
51
        {
52
            tenna.bounce = 1;
53
            var tetalk = stringsetloc(
The secret lawnmower game! Everybody's favorite!
"The secret lawnmower game! Everybody's favorite!", "obj_board_event_lawnmower_slash_Step_0_gml_37_0"
);
54
            
scr_couchtalk
scr_couchtalk

function scr_couchclear(arg0) { with (obj_couchwriter) { if (speaker == arg0) instance_destroy(); } } function
scr_couchtalk(arg0, arg1)
{ var ix = -1; var iy = -1; if (argument_count >= 6) { ix = argument4; iy = argument5; } var couchtext = instance_create_depth(ix, iy, 5000, obj_couchwriter); couchtext.mystring = arg0; couchtext.speaker = arg1; if (argument_count >= 3) couchtext.cleartext = argument2; if (argument_count >= 4) couchtext.drawtime = argument3; if (argument_count >= 7) couchtext.customsnd = argument6; if (argument_count >= 8) couchtext.customcolor = argument7; if (argument_count >= 9) couchtext.talkrate = argument8; if (argument_count >= 10) couchtext.talklength = argument9; return couchtext; }
(tetalk, "tenna", 2, 80);
55
        }
56
        if (tuttimer == 80)
57
        {
58
            tenna.bounce = 1;
59
            var tetalk = stringsetloc(
Push the lawnmower and it will fly! The grass will grow as you mow!
"Push the lawnmower and it will fly! The grass will grow as you mow!", "obj_board_event_lawnmower_slash_Step_0_gml_43_0"
);
60
            
scr_couchtalk
scr_couchtalk

function scr_couchclear(arg0) { with (obj_couchwriter) { if (speaker == arg0) instance_destroy(); } } function
scr_couchtalk(arg0, arg1)
{ var ix = -1; var iy = -1; if (argument_count >= 6) { ix = argument4; iy = argument5; } var couchtext = instance_create_depth(ix, iy, 5000, obj_couchwriter); couchtext.mystring = arg0; couchtext.speaker = arg1; if (argument_count >= 3) couchtext.cleartext = argument2; if (argument_count >= 4) couchtext.drawtime = argument3; if (argument_count >= 7) couchtext.customsnd = argument6; if (argument_count >= 8) couchtext.customcolor = argument7; if (argument_count >= 9) couchtext.talkrate = argument8; if (argument_count >= 10) couchtext.talklength = argument9; return couchtext; }
(tetalk, "tenna", 2, 80);
61
        }
62
        if (tuttimer == 160)
63
        {
64
            tenna.bounce = 1;
65
            var tetalk = stringsetloc(
Cut as much grass as you can before the timer runs out to get some points!!!
"Cut as much grass as you can before the timer runs out to get some points!!!", "obj_board_event_lawnmower_slash_Step_0_gml_49_0"
);
66
            
scr_couchtalk
scr_couchtalk

function scr_couchclear(arg0) { with (obj_couchwriter) { if (speaker == arg0) instance_destroy(); } } function
scr_couchtalk(arg0, arg1)
{ var ix = -1; var iy = -1; if (argument_count >= 6) { ix = argument4; iy = argument5; } var couchtext = instance_create_depth(ix, iy, 5000, obj_couchwriter); couchtext.mystring = arg0; couchtext.speaker = arg1; if (argument_count >= 3) couchtext.cleartext = argument2; if (argument_count >= 4) couchtext.drawtime = argument3; if (argument_count >= 7) couchtext.customsnd = argument6; if (argument_count >= 8) couchtext.customcolor = argument7; if (argument_count >= 9) couchtext.talkrate = argument8; if (argument_count >= 10) couchtext.talklength = argument9; return couchtext; }
(tetalk, "tenna", 2, 80);
67
        }
68
        if (tuttimer < 240 && gamestart == 1)
69
        {
70
            tutcon = 1;
71
            tenna.bounce = 1;
72
            var tetalk = stringsetloc(
Sure, yeah. I was done. Go ahead.
"Sure, yeah. I was done. Go ahead.", "obj_board_event_lawnmower_slash_Step_0_gml_56_0"
);
73
            
scr_couchtalk
scr_couchtalk

function scr_couchclear(arg0) { with (obj_couchwriter) { if (speaker == arg0) instance_destroy(); } } function
scr_couchtalk(arg0, arg1)
{ var ix = -1; var iy = -1; if (argument_count >= 6) { ix = argument4; iy = argument5; } var couchtext = instance_create_depth(ix, iy, 5000, obj_couchwriter); couchtext.mystring = arg0; couchtext.speaker = arg1; if (argument_count >= 3) couchtext.cleartext = argument2; if (argument_count >= 4) couchtext.drawtime = argument3; if (argument_count >= 7) couchtext.customsnd = argument6; if (argument_count >= 8) couchtext.customcolor = argument7; if (argument_count >= 9) couchtext.talkrate = argument8; if (argument_count >= 10) couchtext.talklength = argument9; return couchtext; }
(tetalk, "tenna", 2, 60);
74
        }
75
        if (tuttimer == 240)
76
        {
77
            tenna.bounce = 1;
78
            var tetalk = stringsetloc(
When you're ready, push the lawn mower to start!
"When you're ready, push the lawn mower to start!", "obj_board_event_lawnmower_slash_Step_0_gml_62_0"
);
79
            
scr_couchtalk
scr_couchtalk

function scr_couchclear(arg0) { with (obj_couchwriter) { if (speaker == arg0) instance_destroy(); } } function
scr_couchtalk(arg0, arg1)
{ var ix = -1; var iy = -1; if (argument_count >= 6) { ix = argument4; iy = argument5; } var couchtext = instance_create_depth(ix, iy, 5000, obj_couchwriter); couchtext.mystring = arg0; couchtext.speaker = arg1; if (argument_count >= 3) couchtext.cleartext = argument2; if (argument_count >= 4) couchtext.drawtime = argument3; if (argument_count >= 7) couchtext.customsnd = argument6; if (argument_count >= 8) couchtext.customcolor = argument7; if (argument_count >= 9) couchtext.talkrate = argument8; if (argument_count >= 10) couchtext.talklength = argument9; return couchtext; }
(tetalk, "tenna", 2, 80);
80
            tutcon = 1;
81
        }
82
    }
83
    if (suwalk == 0)
84
    {
85
        suwalk = 1;
86
        ralsei.follow = false;
87
        
scr_pathfind_to_point
scr_pathfind_to_point

function
scr_pathfind_to_point(arg0, arg1, arg2)
{ var __destx = arg1 + 16; var __desty = arg2 + 16; if (arg1 < 12 && arg2 < 8) { __destx = 128 + (32 * arg1) + 16; __desty = 64 + (32 * arg2) + 16; } with (obj_mainchara_board) { if (name == arg0) { path_end(); is_moving_timer = 0; is_moving = true; path_target_x = __destx; path_target_y = __desty; follow = false; if (argument_count == 4) { if (argument3 != -1) path_end_facing = argument3; } if (argument_count == 5) { if (argument4 != -1) allow_diagonals = argument4; } } } }
("susie", 4 - choose(0, 1, 2), 6, 2);
88
        
scr_pathfind_to_point
scr_pathfind_to_point

function
scr_pathfind_to_point(arg0, arg1, arg2)
{ var __destx = arg1 + 16; var __desty = arg2 + 16; if (arg1 < 12 && arg2 < 8) { __destx = 128 + (32 * arg1) + 16; __desty = 64 + (32 * arg2) + 16; } with (obj_mainchara_board) { if (name == arg0) { path_end(); is_moving_timer = 0; is_moving = true; path_target_x = __destx; path_target_y = __desty; follow = false; if (argument_count == 4) { if (argument3 != -1) path_end_facing = argument3; } if (argument_count == 5) { if (argument4 != -1) allow_diagonals = argument4; } } } }
("ralsei", 7 + choose(0, 1), 6, 2);
89
    }
90
    if (gamestart == 1)
91
        timer++;
92
    else
93
        timer = -1;
94
    if (gamestart == 1)
95
    {
96
        gametimer--;
97
        if (gametimer == 30)
98
            mus_volume(lawnmusic, 0, 30);
99
        if (gametimer <= 0)
100
        {
101
            gametimer = 0;
102
            gamestart = -1;
103
            with (obj_board_lawnmower)
104
            {
105
                instance_create(x, y, obj_board_smokepuff);
106
                snd_play(snd_board_bomb);
107
                instance_destroy();
108
            }
109
            scr_delay_var("gamestart", 2, 30);
110
        }
111
    }
112
    if (gamestart == 2)
113
    {
114
        with (obj_board_weedmow)
115
        {
116
            var doomtime = irandom(15);
117
            
scr_script_delayed
scr_script_delayed

function
scr_script_delayed()
{ var __scriptdelay = instance_create(0, 0, obj_script_delayed); __scriptdelay.script = argument[0]; __scriptdelay.alarm[0] = argument[1]; __scriptdelay.target = id; for (var __i = 0; __i < (argument_count - 2); __i++) __scriptdelay.script_arg[__i] = argument[__i + 2]; __scriptdelay.arg_count = argument_count - 2; return __scriptdelay; }
(instance_create, doomtime, x, y, 283);
118
            
scr_script_delayed
scr_script_delayed

function
scr_script_delayed()
{ var __scriptdelay = instance_create(0, 0, obj_script_delayed); __scriptdelay.script = argument[0]; __scriptdelay.alarm[0] = argument[1]; __scriptdelay.target = id; for (var __i = 0; __i < (argument_count - 2); __i++) __scriptdelay.script_arg[__i] = argument[__i + 2]; __scriptdelay.arg_count = argument_count - 2; return __scriptdelay; }
(snd_stop, doomtime, 458);
119
            
scr_script_delayed
scr_script_delayed

function
scr_script_delayed()
{ var __scriptdelay = instance_create(0, 0, obj_script_delayed); __scriptdelay.script = argument[0]; __scriptdelay.alarm[0] = argument[1]; __scriptdelay.target = id; for (var __i = 0; __i < (argument_count - 2); __i++) __scriptdelay.script_arg[__i] = argument[__i + 2]; __scriptdelay.arg_count = argument_count - 2; return __scriptdelay; }
(snd_play, doomtime, snd_board_bomb);
120
            
scr_doom
scr_doom

function
scr_doom(arg0, arg1)
{ with (instance_create_depth(0, 0, 0, obj_doom)) { alarm[0] target = arg0; } }
(id, doomtime);
121
        }
122
        scr_delay_var("gamestart", 3, 16);
123
        gamestart = -1;
124
    }
125
    if (gamestart == 3)
126
    {
127
        snd_stop(lawnmusic);
128
        mus_volume(global.currentsong[1], 1, 30);
129
        with (obj_board_weedmow)
130
        {
131
            instance_create(x, y, obj_board_smokepuff);
132
            snd_stop(snd_board_bomb);
133
            snd_play(snd_board_bomb);
134
            instance_destroy();
135
        }
136
        
scr_board_score
scr_board_score

function
scr_board_score(arg0)
{ var scoreadder = instance_create(x, y, obj_board_scoreAdder); scoreadder.scoreamount = arg0; if (argument_count == 2) scoreadder.mysnd = argument1; } function scr_board_score_set(arg0) { global.flag[1044 points] = arg0; }
(round(mowscore * 10));
137
        kris.cantleave = false;
138
        
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; }
("scorey", 0, -22, 10, 2, "out");
139
        var amt = string(mowscore * 10);
140
        if (global.flag[1267 lawnmower_score] == 0)
141
            global.flag[1267 lawnmower_score] = 1;
142
        if ((mowscore * 10) > global.flag[1267 lawnmower_score])
143
            global.flag[1267 lawnmower_score] = mowscore * 10;
144
        var tetalk = stringsetsubloc("A score of ~1?! IMPRESSIVE!", amt, "obj_board_event_lawnmower_slash_Step_0_gml_130_0");
145
        
scr_couchtalk
scr_couchtalk

function scr_couchclear(arg0) { with (obj_couchwriter) { if (speaker == arg0) instance_destroy(); } } function
scr_couchtalk(arg0, arg1)
{ var ix = -1; var iy = -1; if (argument_count >= 6) { ix = argument4; iy = argument5; } var couchtext = instance_create_depth(ix, iy, 5000, obj_couchwriter); couchtext.mystring = arg0; couchtext.speaker = arg1; if (argument_count >= 3) couchtext.cleartext = argument2; if (argument_count >= 4) couchtext.drawtime = argument3; if (argument_count >= 7) couchtext.customsnd = argument6; if (argument_count >= 8) couchtext.customcolor = argument7; if (argument_count >= 9) couchtext.talkrate = argument8; if (argument_count >= 10) couchtext.talklength = argument9; return couchtext; }
(tetalk, "tenna", 2, 60);
146
        gamestart = -1;
147
        scr_delay_var("gamestart", 4, 30);
148
    }
149
    if (gamestart == 4)
150
    {
151
        kris.cantleave = false;
152
        gamestart = 5;
153
    }
154
    var weedcount = instance_number(obj_board_weedmow);
155
    if ((timer % 15) == 0 && weedcount < 32)
156
    {
157
        var weed = instance_create(x, y, obj_board_weedmow);
158
        with (weed)
159
        {
160
            var safe = 0;
161
            var failsafe = 0;
162
            while (safe == 0)
163
            {
164
                setxy(board_tilex(irandom_range(2, 9)), board_tiley(irandom_range(2, 5)));
165
                safe = 1;
166
                if (place_meeting(x, y, obj_board_lawnmower))
167
                    safe = 0;
168
                if (place_meeting(x, y, obj_board_solidenemy))
169
                    safe = 0;
170
                if (place_meeting(x, y, obj_board_weedmow))
171
                    safe = 0;
172
                with (obj_board_lawnmower)
173
                {
174
                    if (x == other.x)
175
                        safe = 0;
176
                }
177
                with (obj_board_lawnmower)
178
                {
179
                    if (y == other.y)
180
                        safe = 0;
181
                }
182
                failsafe++;
183
                if (failsafe > 10)
184
                {
185
                    safe = 1;
186
                    instance_destroy();
187
                }
188
            }
189
        }
190
    }
191
}
192
else
193
{
194
    suwalk = 0;
195
}