Deltarune (Chapter 3) script viewer

← back to main script listing

gml_Object_obj_board_tvdinner_Step_0

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

function
scr_gameshow_populatevars()
{ if (!variable_instance_exists(id, "kr_real")) kr_real = 0; if (!variable_instance_exists(id, "su_real")) su_real = 0; if (!variable_instance_exists(id, "ra_real")) ra_real = 0; if (!variable_instance_exists(id, "tenna")) tenna = 0; if (kr_real == 0) { with (obj_mainchara) other.kr_real = id; } if (su_real == 0) { with (obj_caterpillarchara) { if (name == "susie") other.su_real = id; } } if (ra_real == 0) { with (obj_caterpillarchara) { if (name == "ralsei") other.ra_real = id; } } if (tenna == 0) { with (obj_actor_tenna) other.tenna = id; } }
();
2
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; } } }
();
3
if (active)
4
{
5
    if (con == 0)
6
        
scr_depth_board
scr_depth_board

function
scr_depth_board()
{ depth = 1000000 - ((y * 10) + ((sprite_height - sprite_yoffset) * 10)); } function scr_board_depth() {
scr_depth_board();
}
();
7
    buyable = false;
8
    if (tvdinnerqty == -1)
9
    {
10
        
scr_itemcheck_inventory_and_pocket
scr_itemcheck_inventory_and_pocket

function
scr_itemcheck_inventory_and_pocket(arg0)
{ var _haveeither = 0; var itemcounttotal = 0;
scr_itemcheck(arg0);
if (haveit == 1) _haveeither = 1; itemcounttotal += itemcount;
scr_itemcheck_pocket(arg0);
if (haveit == 1) _haveeither = 1; itemcounttotal += itemcount; haveit = _haveeither; itemcount = itemcounttotal; return haveit; }
(34);
11
        tvdinnerqty = itemcount;
12
    }
13
    cost = 20;
14
    if (tvdinnerqty == 1)
15
        cost = 50;
16
    if (tvdinnerqty == 2)
17
        cost = 100;
18
    if (tvdinnerqty >= 3)
19
        cost = 200;
20
    if (room == room_board_2)
21
        cost = 400;
22
    if (costfree)
23
        cost = 0;
24
    if (room == room_board_1)
25
    {
26
        if (obj_b1store.pointcount <= 10)
27
            cost = 10;
28
    }
29
    if (result == -1)
30
        result = 
scr_inventoryspace
scr_inventoryspace

function
scr_inventoryspace()
{ var freespace = 0; var inventoryspace = 12; for (var i = 0; i < inventoryspace; i++) { if (global.item[i] == 0) freespace++; } debug_message("from " + object_get_name(object_index) + ":
scr_inventoryspace(): free inventory slots=" + string(freespace));
return freespace; } function scr_pocketspace() { var pocketspace = 0; for (var i = 0; i < global.flag[64 storage_size]; i++) { if (global.pocketitem[i] == 0) pocketspace++; } debug_message("from " + object_get_name(object_index) + ": scr_pocketspace(): free pocket slots=" + string(pocketspace)); return pocketspace; }
() + scr_pocketspace();
31
    if (result)
32
    {
33
        haveroom = true;
34
        freestring = stringsetloc(
FREE
"FREE", "obj_board_tvdinner_slash_Step_0_gml_30_0"
);
35
        mystring = stringsetloc(
TVDINNER
"TVDINNER", "obj_board_tvdinner_slash_Step_0_gml_31_0"
);
36
        if (cost != 0)
37
            mystring += ("#" + string(cost));
38
        else
39
            mystring += ("#" + freestring);
40
    }
41
    else
42
    {
43
        haveroom = false;
44
        mystring = stringsetloc(
REAL ITEMS#FULL
"REAL ITEMS#FULL", "obj_board_tvdinner_slash_Step_0_gml_38_0"
);
45
    }
46
    if (global.flag[1044 points] >= cost && haveroom)
47
        buyable = true;
48
    if (myinteract == 3)
49
    {
50
        if (buyable)
51
        {
52
            
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; }
(-cost);
53
            global.interact = 1;
54
            myinteract = 4;
55
            con = 1;
56
        }
57
        else
58
        {
59
            myinteract = 0;
60
        }
61
    }
62
    if (myinteract > 3)
63
        mystring = "";
64
}
65
if (con == 1)
66
{
67
    var transitiontime = 12;
68
    var spintime = 1;
69
    var spindelay = 3;
70
    timer++;
71
    if (timer == 1)
72
    {
73
        depth = kris.depth - 1;
74
        with (kris)
75
        {
76
            fun = 1;
77
            sprite_index = dsprite;
78
            scr_delay_var("sprite_index", lsprite, spintime * 3);
79
            scr_delay_var("facing", 3, spintime * 3);
80
            scr_delay_var("sprite_index", usprite, spintime * 4);
81
            scr_delay_var("facing", 2, spintime * 4);
82
            scr_delay_var("sprite_index", rsprite, spintime * 5);
83
            scr_delay_var("facing", 1, spintime * 5);
84
            scr_delay_var("sprite_index", dsprite, spintime * 6);
85
            scr_delay_var("facing", 0, spintime * 6);
86
            scr_delay_var("sprite_index", lsprite, spintime * 7);
87
            scr_delay_var("facing", 3, spintime * 7);
88
            scr_delay_var("sprite_index", usprite, spintime * 8);
89
            scr_delay_var("facing", 2, spintime * 8);
90
            scr_delay_var("sprite_index", rsprite, spintime * 9);
91
            scr_delay_var("facing", 1, spintime * 9);
92
            scr_delay_var("sprite_index", dsprite_item, spintime * 10);
93
            scr_delay_var("facing", 0, spintime * 10);
94
        }
95
        
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; }
("x", x, kris.x + xoff, transitiontime, 2, "in");
96
        
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; }
("y", y, (kris.y + yoff) - 40, transitiontime, 2, "out");
97
    }
98
    if (timer == (1 + transitiontime))
99
    {
100
        snd_play(snd_link_sfx_itemget);
101
        makestars = true;
102
        
scr_itemget
scr_itemget

function
scr_itemget(arg0)
{ var __i = 0; var loop = 1; noroom = 0; _pocketed = 0; _noroominventory = 0; global.item[12] = 999; while (loop == 1) { if (global.item[__i] == 0) { global.item[__i] = arg0; break; } if (__i == 12) { _noroominventory = 1; noroom = 1; for (var __j = 0; __j < global.flag[64 storage_size]; __j++) { if (global.pocketitem[__j] == 0) { debug_message("Placed in pocket :" + string(__j)); global.pocketitem[__j] = arg0; _pocketed = 1; noroom = 0; break; } } break; } __i += 1; } script_execute(scr_iteminfo_all); debug_message("noroom=" + string(noroom)); debug_message("_pocketed=" + string(_pocketed)); debug_message("_noroominventory=" + string(_noroominventory)); }
(34);
103
        
scr_speaker
scr_speaker

function
scr_speaker(arg0)
{ _speaker = arg0; global.typer = 5; if (global.darkzone == 1) global.typer = 6; if (global.fighting == 1) global.typer = 4; global.fc = 0; global.fe = 0; if (_speaker == "silent" && global.darkzone == 0) global.typer = 2; if (_speaker == "silent" && global.darkzone == 1) global.typer = 36; if (_speaker == "balloon" || _speaker == "enemy") global.typer = 50; if (_speaker == "sans") { global.typer = 14; global.fc = 6; } if (_speaker == "undyne" || _speaker == "und") { global.typer = 17; global.fc = 9; } if (_speaker == "temmie" || _speaker == "tem") global.typer = 21; if (_speaker == "jevil") global.typer = 35; if (_speaker == "catti") global.fc = 13; if (_speaker == "jockington" || _speaker == "joc") global.fc = 14; if (_speaker == "catty" || _speaker == "caddy") global.fc = 16; if (_speaker == "bratty" || _speaker == "bra") global.fc = 17; if (_speaker == "rouxls" || _speaker == "rou") global.fc = 18; if (_speaker == "burgerpants" || _speaker == "bur") global.fc = 19; if (_speaker == "spamton") { if (global.fighting == 0) global.typer = 66; else global.typer = 68; } if (_speaker == "sneo") global.typer = 67; if (_speaker == "tenna") { global.typer = 80; if (global.fighting == 1) global.typer = 81; } if (_speaker == "susie" || _speaker == "sus") { global.fc = 1; global.typer = 10; if (global.darkzone == 1) { global.typer = 30; if (global.fighting == 1) global.typer = 47; } } if (_speaker == "ralsei" || _speaker == "ral") { global.fc = 2; global.typer = 31; if (global.fighting == 1) global.typer = 45; if (global.flag[30 ralsei_hat_state] == 1) global.typer = 6; } if (_speaker == "noelle" || _speaker == "noe") { global.fc = 3; if (global.darkzone == 0) global.typer = 12; else global.typer = 56; if (global.fighting == 1) global.typer = 59; } if (_speaker == "toriel" || _speaker == "tor") { global.fc = 4; global.typer = 7; } if (_speaker == "asgore" || _speaker == "asg") { global.fc = 10; global.typer = 18; } if (_speaker == "king" || _speaker == "kin") { global.fc = 20; global.typer = 33; ...
("no_name");
104
        msgsetloc(0, 
YOU BOUGHT TVDINNER!Delay 11 FEEL FREE TO USE IT IN BATTLE!!Wait for inputClose Message
"YOU BOUGHT \\cYTVDINNER\\cW^1! FEEL FREE TO USE IT IN BATTLE!!/%", "obj_board_tvdinner_slash_Step_0_gml_114_0"
);
105
        bw_make();
106
        timer = 0;
107
        con = 2;
108
    }
109
}
110
if (con == 2 && !bw_ex())
111
{
112
    var flytime1 = 15;
113
    var flytime2 = 25;
114
    timer++;
115
    if (timer == 1)
116
    {
117
        
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; }
("y", y, board_tiley(-1), flytime1, 2, "in");
118
        scr_delay_var("image_alpha", 0, flytime1 + 1);
119
    }
120
    if (timer == (1 + flytime1))
121
    {
122
        kris.facing = 0;
123
        kris.fun = 0;
124
        snd_play(snd_wing);
125
        item = 
scr_marker_ext
scr_marker_ext

function
scr_marker_ext(arg0, arg1, arg2, arg3 = 1, arg4 = 1, arg5 = 0, arg6 = 0, arg7 = 16777215, arg8 = depth, arg9 = false, arg10 = -1, arg11 = 1)
{ var thismarker = instance_create(arg0, arg1, obj_marker); with (thismarker) { depth = arg8; sprite_index = arg2; image_speed = arg5; image_xscale = arg3; image_yscale = arg4; image_index = arg6; image_blend = arg7; image_alpha = arg11; if (arg9)
scr_depth();
} if (arg10 > 0)
scr_doom(thismarker, arg10);
return thismarker; }
(camerax() + 640, cameray() + 240, spr_itemBag, 2, 2, 0, 2, c_white, obj_mainchara.depth + 1);
126
        with (item)
127
        {
128
            
scr_jump_to_point
scr_jump_to_point

function
scr_jump_to_point(arg0, arg1, arg2, arg3, arg4 = 0)
{ var ___jump =
scr_jump_to_point_sprite(arg0, arg1, arg2, arg3, 0, 0);
with (___jump) { trackalpha = arg4; trackblend = arg4; trackindex = arg4; tracksprite = arg4; } return ___jump; }
(obj_mainchara.x + 8, obj_mainchara.y + 8, 20, flytime2, true);
129
            snd_play_delay(snd_item, flytime2, 1, 1);
130
            
scr_doom
scr_doom

function
scr_doom(arg0, arg1)
{ with (instance_create_depth(0, 0, 0, obj_doom)) { alarm[0] target = arg0; } }
(id, flytime2 + 1);
131
        }
132
    }
133
    if (timer == (1 + flytime1 + flytime2))
134
    {
135
        global.interact = 0;
136
        instance_destroy();
137
    }
138
}
139
if (makestars == true)
140
{
141
    var stardepth = kris.depth + 1;
142
    makestarstimer++;
143
    if ((makestarstimer % 2) == 0)
144
    {
145
        var star = 
scr_board_marker
scr_board_marker

function
scr_board_marker()
{ var _thismarker = instance_create(argument0, argument1, obj_board_marker); _thismarker.sprite_index = argument2; _thismarker.image_xscale = 2; _thismarker.image_yscale = 2; if (argument_count >= 4) _thismarker.image_speed = argument3; if (argument_count >= 5) { if (argument4 != -1) _thismarker.depth = argument4; } if (argument_count >= 6) _thismarker.image_xscale = argument5; if (argument_count >= 6) _thismarker.image_yscale = argument5; if (argument_count >= 7) _thismarker.animateonce = argument6; return _thismarker; }
(x - xoff, y - yoff, spr_board_star_8px, 0, stardepth);
146
        with (star)
147
        {
148
            direction = other.makestarstimer * 20;
149
            speed = 5;
150
            friction = 0.25;
151
            image_index = irandom(3);
152
            
scr_doom
scr_doom

function
scr_doom(arg0, arg1)
{ with (instance_create_depth(0, 0, 0, obj_doom)) { alarm[0] target = arg0; } }
(id, random_range(13, 16));
153
        }
154
        star = 
scr_board_marker
scr_board_marker

function
scr_board_marker()
{ var _thismarker = instance_create(argument0, argument1, obj_board_marker); _thismarker.sprite_index = argument2; _thismarker.image_xscale = 2; _thismarker.image_yscale = 2; if (argument_count >= 4) _thismarker.image_speed = argument3; if (argument_count >= 5) { if (argument4 != -1) _thismarker.depth = argument4; } if (argument_count >= 6) _thismarker.image_xscale = argument5; if (argument_count >= 6) _thismarker.image_yscale = argument5; if (argument_count >= 7) _thismarker.animateonce = argument6; return _thismarker; }
(x - xoff, y - yoff, spr_board_star_8px, 0, stardepth);
155
        with (star)
156
        {
157
            direction = (other.makestarstimer * 20) + 180;
158
            speed = 5;
159
            friction = 0.25;
160
            image_index = irandom(3);
161
            
scr_doom
scr_doom

function
scr_doom(arg0, arg1)
{ with (instance_create_depth(0, 0, 0, obj_doom)) { alarm[0] target = arg0; } }
(id, random_range(13, 16));
162
        }
163
    }
164
    if (makestarstimer >= 16)
165
        makestars = false;
166
}
167
if (!active)
168
{
169
    result = -1;
170
    tvdinnerqty = -1;
171
}