Undertale script viewer

← back to main script listing

gml_Script_scr_drawtext_icons_multiline

(view raw script w/o annotations or w/e)
1
var x0 = argument[0];
2
var y0 = argument[1];
3
var str = scr_replace_buttons_pc
scr_replace_buttons_pc

var str = argument0; if (global.osflavor <= 2) { str = string_replace_all(str, "\*Z", "[Z]"); str = string_replace_all(str, "\*X", "[X]"); str = string_replace_all(str, "\*C", "[C]"); str = string_replace_all(str, "\*A",
[LEFT]
scr_gettext("key_left")
); str = string_replace_all(str, "\*D",
[RIGHT]
scr_gettext("key_right")
); } return str;
(argument[2]);
4
var icon_scale = 1;
5
if (argument_count >= 4)
6
    icon_scale = argument[3];
7
var len = strlen(str);
8
var line_height = string_height(" ");
9
var outstr = "";
10
var xx = argument[0];
11
var yy = argument[1];
12
for (var i = 1; i < len; i++)
13
{
14
    if (substr(str, i, 1) == "#")
15
    {
16
        if (outstr != "")
17
        {
18
            draw_text(xx, yy, outstr);
19
            outstr = "";
20
        }
21
        xx = x0;
22
        yy += line_height;
23
    }
24
    else if (substr(str, i, 2) == "\*")
25
    {
26
        if (outstr != "")
27
        {
28
            draw_text(xx, yy, outstr);
29
            xx += round(string_width(outstr));
30
            outstr = "";
31
        }
32
        i += 2;
33
        var sprite = scr_getbuttonsprite
scr_getbuttonsprite

var control = argument0; var type = argument1; if (control == "A") { if (os_type == os_ps4) return button_ps4_dpad_l; if (os_type == os_psvita) return button_vita_dpad_l; return noone; } if (control == "D") { if (os_type == os_ps4) return button_ps4_dpad_r; if (os_type == os_psvita) return button_vita_dpad_r; return noone; } var button = -4; if (control == "Z") button = global.button0; if (control == "X") button = global.button1; if (control == "C") button = global.button2; if (button == gp_face1) { if (os_type == os_ps4) { if (type == 1) return buttonL_ps4_cross; return button_ps4_cross; } if (os_type == os_psvita) { if (type == 1) return buttonL_vita_cross; return button_vita_cross; } } if (button == gp_face2) { if (os_type == os_ps4) { if (type == 1) return buttonL_ps4_circle; return button_ps4_circle; } if (os_type == os_psvita) { if (type == 1) return buttonL_vita_circle; return button_vita_circle; } } if (button == gp_face3) { if (os_type == os_ps4) { if (type == 1) return buttonL_ps4_square; return button_ps4_square; } if (os_type == os_psvita) { if (type == 1) return buttonL_vita_square; return button_vita_square; } } if (button == gp_face4) { if (os_type == os_ps4) { if (type == 1) return buttonL_ps4_triangle; return button_ps4_triangle; } if (os_type == os_psvita) { if (type == 1) return buttonL_vita_triangle; return button_vita_triangle; } } if (button == gp_shoulderl) { if (os_type == os_ps4) { if (type == 1) return buttonL_ps4_l1; return button_ps4_l1; } if (os_type == os_psvita) { if (type == 1) return buttonL_vita_l; return button_vita_l; } } if (button == gp_shoulderlb) ...
(substr(str, i, 1), 0);
34
        if (sprite != -4)
35
        {
36
            draw_sprite_ext(sprite, 0, xx, yy, icon_scale, icon_scale, 0, c_white, 1);
37
            xx += ((sprite_get_width(sprite) + 1) * icon_scale);
38
        }
39
    }
40
    else
41
    {
42
        outstr += substr(str, i, 1);
43
    }
44
}
45
if (outstr != "")
46
    draw_text(xx, yy, outstr);