Deltarune (Chapter 4) script viewer

← back to main script listing

gml_GlobalScript_scr_walkntalk

(view raw script w/o annotations or w/e)
1
function scr_walkntalk_create()
2
{
3
    auto_talk = false;
4
}
5
6
function scr_walkntalk_start(arg0 = false, arg1 = 4, arg2 = 1)
7
{
8
    var d = d_make();
9
    d.runcheck = 1;
10
    d.zurasu = 1;
11
    d.stay = 1;
12
    d.side = arg2;
13
    auto_talk = 1;
14
    global.flag[7 disable_menu?] = 1;
15
    if (arg0)
16
    {
17
        with (instance_create(0, 0, obj_slowwalk))
18
        {
19
            
scr_sizeexact
scr_sizeexact

function
scr_sizeexact(arg0, arg1, arg2 = id)
{ with (arg2) { if (!sprite_exists(sprite_index)) { debug_message("Can't size, no sprite"); exit; } var _w = sprite_get_width(sprite_index); var _h = sprite_get_width(sprite_index); image_xscale = arg0 / _w; image_yscale = arg1 / _h; } }
(room_width, room_height);
20
            maxwalkspeed = arg1;
21
            extflag = "temporary walkntalk";
22
        }
23
    }
24
}
25
26
function scr_walkntalk_stop()
27
{
28
    auto_talk = 0;
29
    global.flag[7 disable_menu?] = 0;
30
    with (obj_slowwalk)
31
    {
32
        if (variable_instance_exists(id, "extflag"))
33
        {
34
            if (extflag == "temporary walkntalk")
35
                instance_destroy();
36
        }
37
    }
38
}
39
40
function scr_walkntalk_action(arg0 = false)
41
{
42
    if (auto_talk)
43
    {
44
        if (d_ex())
45
        {
46
            if (instance_exists(obj_writer))
47
            {
48
                if (obj_writer.halt != 0)
49
                {
50
                    if (!variable_instance_exists(id, "talk_timer"))
51
                        talk_timer = 0;
52
                    talk_timer++;
53
                    var max_timer = (global.lang == "ja") ? 90 : 60;
54
                    if (talk_timer >= max_timer)
55
                    {
56
                        with (obj_writer)
57
                            forcebutton1 = 1;
58
                        talk_timer = 0;
59
                    }
60
                }
61
                else
62
                {
63
                    talk_timer = 0;
64
                }
65
            }
66
        }
67
        if (arg0)
68
        {
69
            if (variable_instance_exists(id, "beginx") && variable_instance_exists(id, "kris"))
70
            {
71
                if (kris.x > beginx)
72
                    roomloop = 1;
73
            }
74
        }
75
    }
76
}