Undertale script viewer

← back to main script listing

gml_Object_obj_soundtest_Draw_0

(view raw script w/o annotations or w/e)
1
if (con == 0)
2
{
3
    draw_set_color(c_white);
4
    scr_setfont
scr_setfont

var newfont = argument0; if (global.language == "ja") { if (newfont == fnt_main) newfont = fnt_ja_main; if (newfont == fnt_maintext) newfont = fnt_ja_maintext; if (newfont == fnt_plain) newfont = fnt_ja_plain; } draw_set_font(newfont);
(fnt_main);
5
    scr_drawtext_icons_multiline
scr_drawtext_icons_multiline

var x0 = argument[0]; var y0 = argument[1]; var str = scr_replace_buttons_pc(argument[2]); var icon_scale = 1; if (argument_count >= 4) icon_scale = argument[3]; var len = strlen(str); var line_height = string_height(" "); var outstr = ""; var xx = argument[0]; var yy = argument[1]; for (var i = 1; i < len; i++) { if (substr(str, i, 1) == "#") { if (outstr != "") { draw_text(xx, yy, outstr); outstr = ""; } xx = x0; yy += line_height; } else if (substr(str, i, 2) == "\*") { if (outstr != "") { draw_text(xx, yy, outstr); xx += round(string_width(outstr)); outstr = ""; } i += 2; var sprite = scr_getbuttonsprite(substr(str, i, 1), 0); if (sprite != -4) { draw_sprite_ext(sprite, 0, xx, yy, icon_scale, icon_scale, 0, c_white, 1); xx += ((sprite_get_width(sprite) + 1) * icon_scale); } } else { outstr += substr(str, i, 1); } } if (outstr != "") draw_text(xx, yy, outstr);
(120, 50,
Welcome to the Sound Test!#Listen to all your favorites.#Press Left or Right to select.#Press \*Z to play a song.#
scr_gettext
scr_gettext

var text_id = argument[0]; var text = ds_map_find_value(global.text_data_en, text_id); if (is_undefined(text)) text = ""; if (global.language == "ja") { var loc_text = ds_map_find_value(global.text_data_ja, text_id); if (!is_undefined(loc_text)) text = loc_text; } for (var i = 1; i <= (string_length(text) - 3); i++) { if (string_copy(text, i, 2) == "\[" && string_char_at(text, i + 3) == "]") { var sel = string_char_at(text, i + 2); var replace; if (sel == "C") replace = global.charname; else if (sel == "G") replace = string(global.gold); else if (sel == "I") replace = global.itemname[global.menucoord[1]]; else if (sel == "1" && argument_count > 1) replace = argument[1]; else if (sel == "2" && argument_count > 2) replace = argument[2]; else if (sel == "3" && argument_count > 3) replace = argument[3]; else if (sel == "4" && argument_count > 4) replace = argument[4]; else if (sel == "5" && argument_count > 5) replace = argument[5]; else if (sel == "6" && argument_count > 6) replace = argument[6]; else if (sel == "7" && argument_count > 7) replace = argument[7]; else if (sel == "8" && argument_count > 8) replace = argument[8]; else if (sel == "9" && argument_count > 9) replace = argument[9]; else replace = ""; var before = string_copy(text, 1, i - 1); var after = string_copy(text, i + 4, string_length(text)); text = before + replace + after; i += (string_length(replace) - 1); } } return text;
("soundtest_welcome")
, 2);
6
    buffer += 1;
7
    if (buffer >= 20)
8
    {
9
        if (control_check_pressed(0))
10
        {
11
            buffer = -10;
12
            con = 1;
13
            songno = 0;
14
            audio_play_sound(mus_st_happytown, 50, true);
15
        }
16
    }
17
}
18
if (con == 1)
19
{
20
    draw_set_color(c_white);
21
    scr_drawtext_centered_scaled
scr_drawtext_centered_scaled

var xx = argument0; var yy = argument1; var text = argument2; var xscale = argument3; var yscale = argument4; var display_scale = surface_get_width(application_surface) / view_wview[view_current]; var lineheight = round(string_height(" ") * yscale); var eol = string_pos("#", text); yy = round(yy * display_scale) / display_scale; while (eol != 0) { var line = substr(text, 1, eol); text = substr(text, eol + 1); width = string_width(line) * xscale; var line_x = round((xx - (width / 2)) * display_scale) / display_scale; draw_text_transformed(line_x, yy, line, xscale, yscale, 0); yy += lineheight; eol = string_pos("#", text); } var width = string_width(text) * xscale; draw_text_transformed(round(xx - (width / 2)), yy, text, xscale, yscale, 0);
(320, 50,
SOUND TEST
scr_gettext
scr_gettext

var text_id = argument[0]; var text = ds_map_find_value(global.text_data_en, text_id); if (is_undefined(text)) text = ""; if (global.language == "ja") { var loc_text = ds_map_find_value(global.text_data_ja, text_id); if (!is_undefined(loc_text)) text = loc_text; } for (var i = 1; i <= (string_length(text) - 3); i++) { if (string_copy(text, i, 2) == "\[" && string_char_at(text, i + 3) == "]") { var sel = string_char_at(text, i + 2); var replace; if (sel == "C") replace = global.charname; else if (sel == "G") replace = string(global.gold); else if (sel == "I") replace = global.itemname[global.menucoord[1]]; else if (sel == "1" && argument_count > 1) replace = argument[1]; else if (sel == "2" && argument_count > 2) replace = argument[2]; else if (sel == "3" && argument_count > 3) replace = argument[3]; else if (sel == "4" && argument_count > 4) replace = argument[4]; else if (sel == "5" && argument_count > 5) replace = argument[5]; else if (sel == "6" && argument_count > 6) replace = argument[6]; else if (sel == "7" && argument_count > 7) replace = argument[7]; else if (sel == "8" && argument_count > 8) replace = argument[8]; else if (sel == "9" && argument_count > 9) replace = argument[9]; else replace = ""; var before = string_copy(text, 1, i - 1); var after = string_copy(text, i + 4, string_length(text)); text = before + replace + after; i += (string_length(replace) - 1); } } return text;
("soundtest_title")
, 2, 2);
22
    if (songno == 0)
23
    {
24
        if (audio_is_playing(mus_st_happytown))
25
        {
26
            draw_set_color(c_yellow);
27
        }
28
        else if (control_check_pressed(0) && gaster == 0)
29
        {
30
            audio_stop_all();
31
            audio_play_sound(mus_st_happytown, 50, true);
32
        }
33
        scr_drawtext_centered
scr_drawtext_centered

var xx = argument0; var yy = argument1; var text = argument2; scr_drawtext_centered_scaled(xx, yy, text, 1, 1);
(320, 200,
Happy Town
scr_gettext
scr_gettext

var text_id = argument[0]; var text = ds_map_find_value(global.text_data_en, text_id); if (is_undefined(text)) text = ""; if (global.language == "ja") { var loc_text = ds_map_find_value(global.text_data_ja, text_id); if (!is_undefined(loc_text)) text = loc_text; } for (var i = 1; i <= (string_length(text) - 3); i++) { if (string_copy(text, i, 2) == "\[" && string_char_at(text, i + 3) == "]") { var sel = string_char_at(text, i + 2); var replace; if (sel == "C") replace = global.charname; else if (sel == "G") replace = string(global.gold); else if (sel == "I") replace = global.itemname[global.menucoord[1]]; else if (sel == "1" && argument_count > 1) replace = argument[1]; else if (sel == "2" && argument_count > 2) replace = argument[2]; else if (sel == "3" && argument_count > 3) replace = argument[3]; else if (sel == "4" && argument_count > 4) replace = argument[4]; else if (sel == "5" && argument_count > 5) replace = argument[5]; else if (sel == "6" && argument_count > 6) replace = argument[6]; else if (sel == "7" && argument_count > 7) replace = argument[7]; else if (sel == "8" && argument_count > 8) replace = argument[8]; else if (sel == "9" && argument_count > 9) replace = argument[9]; else replace = ""; var before = string_copy(text, 1, i - 1); var after = string_copy(text, i + 4, string_length(text)); text = before + replace + after; i += (string_length(replace) - 1); } } return text;
("soundtest_track_happytown")
);
34
    }
35
    if (songno == 1)
36
    {
37
        if (audio_is_playing(mus_st_meatfactory))
38
        {
39
            draw_set_color(c_yellow);
40
        }
41
        else if (control_check_pressed(0) && gaster == 0)
42
        {
43
            audio_stop_all();
44
            audio_play_sound(mus_st_meatfactory, 50, true);
45
        }
46
        scr_drawtext_centered
scr_drawtext_centered

var xx = argument0; var yy = argument1; var text = argument2; scr_drawtext_centered_scaled(xx, yy, text, 1, 1);
(320, 200,
Meat Factory
scr_gettext
scr_gettext

var text_id = argument[0]; var text = ds_map_find_value(global.text_data_en, text_id); if (is_undefined(text)) text = ""; if (global.language == "ja") { var loc_text = ds_map_find_value(global.text_data_ja, text_id); if (!is_undefined(loc_text)) text = loc_text; } for (var i = 1; i <= (string_length(text) - 3); i++) { if (string_copy(text, i, 2) == "\[" && string_char_at(text, i + 3) == "]") { var sel = string_char_at(text, i + 2); var replace; if (sel == "C") replace = global.charname; else if (sel == "G") replace = string(global.gold); else if (sel == "I") replace = global.itemname[global.menucoord[1]]; else if (sel == "1" && argument_count > 1) replace = argument[1]; else if (sel == "2" && argument_count > 2) replace = argument[2]; else if (sel == "3" && argument_count > 3) replace = argument[3]; else if (sel == "4" && argument_count > 4) replace = argument[4]; else if (sel == "5" && argument_count > 5) replace = argument[5]; else if (sel == "6" && argument_count > 6) replace = argument[6]; else if (sel == "7" && argument_count > 7) replace = argument[7]; else if (sel == "8" && argument_count > 8) replace = argument[8]; else if (sel == "9" && argument_count > 9) replace = argument[9]; else replace = ""; var before = string_copy(text, 1, i - 1); var after = string_copy(text, i + 4, string_length(text)); text = before + replace + after; i += (string_length(replace) - 1); } } return text;
("soundtest_track_meatfactory")
);
47
    }
48
    if (songno == 2)
49
    {
50
        if (audio_is_playing(mus_st_troubledingle))
51
        {
52
            draw_set_color(c_yellow);
53
        }
54
        else if (control_check_pressed(0) && gaster == 0)
55
        {
56
            audio_stop_all();
57
            audio_play_sound(mus_st_troubledingle, 50, true);
58
        }
59
        scr_drawtext_centered
scr_drawtext_centered

var xx = argument0; var yy = argument1; var text = argument2; scr_drawtext_centered_scaled(xx, yy, text, 1, 1);
(320, 200,
Trouble Dingle
scr_gettext
scr_gettext

var text_id = argument[0]; var text = ds_map_find_value(global.text_data_en, text_id); if (is_undefined(text)) text = ""; if (global.language == "ja") { var loc_text = ds_map_find_value(global.text_data_ja, text_id); if (!is_undefined(loc_text)) text = loc_text; } for (var i = 1; i <= (string_length(text) - 3); i++) { if (string_copy(text, i, 2) == "\[" && string_char_at(text, i + 3) == "]") { var sel = string_char_at(text, i + 2); var replace; if (sel == "C") replace = global.charname; else if (sel == "G") replace = string(global.gold); else if (sel == "I") replace = global.itemname[global.menucoord[1]]; else if (sel == "1" && argument_count > 1) replace = argument[1]; else if (sel == "2" && argument_count > 2) replace = argument[2]; else if (sel == "3" && argument_count > 3) replace = argument[3]; else if (sel == "4" && argument_count > 4) replace = argument[4]; else if (sel == "5" && argument_count > 5) replace = argument[5]; else if (sel == "6" && argument_count > 6) replace = argument[6]; else if (sel == "7" && argument_count > 7) replace = argument[7]; else if (sel == "8" && argument_count > 8) replace = argument[8]; else if (sel == "9" && argument_count > 9) replace = argument[9]; else replace = ""; var before = string_copy(text, 1, i - 1); var after = string_copy(text, i + 4, string_length(text)); text = before + replace + after; i += (string_length(replace) - 1); } } return text;
("soundtest_track_troubledingle")
);
60
    }
61
    if (songno == 3)
62
    {
63
        if (audio_is_playing(mus_st_him))
64
        {
65
            draw_set_color(c_yellow);
66
        }
67
        else if (control_check_pressed(0) && gaster == 0)
68
        {
69
            gaster = 1;
70
            audio_stop_all();
71
            audio_play_sound(mus_st_him, 50, true);
72
        }
73
        scr_drawtext_centered
scr_drawtext_centered

var xx = argument0; var yy = argument1; var text = argument2; scr_drawtext_centered_scaled(xx, yy, text, 1, 1);
(320, 200,
Gaster's Theme
scr_gettext
scr_gettext

var text_id = argument[0]; var text = ds_map_find_value(global.text_data_en, text_id); if (is_undefined(text)) text = ""; if (global.language == "ja") { var loc_text = ds_map_find_value(global.text_data_ja, text_id); if (!is_undefined(loc_text)) text = loc_text; } for (var i = 1; i <= (string_length(text) - 3); i++) { if (string_copy(text, i, 2) == "\[" && string_char_at(text, i + 3) == "]") { var sel = string_char_at(text, i + 2); var replace; if (sel == "C") replace = global.charname; else if (sel == "G") replace = string(global.gold); else if (sel == "I") replace = global.itemname[global.menucoord[1]]; else if (sel == "1" && argument_count > 1) replace = argument[1]; else if (sel == "2" && argument_count > 2) replace = argument[2]; else if (sel == "3" && argument_count > 3) replace = argument[3]; else if (sel == "4" && argument_count > 4) replace = argument[4]; else if (sel == "5" && argument_count > 5) replace = argument[5]; else if (sel == "6" && argument_count > 6) replace = argument[6]; else if (sel == "7" && argument_count > 7) replace = argument[7]; else if (sel == "8" && argument_count > 8) replace = argument[8]; else if (sel == "9" && argument_count > 9) replace = argument[9]; else replace = ""; var before = string_copy(text, 1, i - 1); var after = string_copy(text, i + 4, string_length(text)); text = before + replace + after; i += (string_length(replace) - 1); } } return text;
("soundtest_track_him")
);
74
    }
75
    buffer += 1;
76
    if (keyboard_check_pressed(vk_left) && buffer > 0 && active_l < 0)
77
    {
78
        if (gaster == 0)
79
        {
80
            songno += 1;
81
            if (songno > 3)
82
                songno = 0;
83
            active_l = 10;
84
        }
85
        else
86
        {
87
            active_l = 2;
88
            songno -= 1;
89
            if (songno < 0)
90
                songno = 3;
91
        }
92
    }
93
    if (keyboard_check_pressed(vk_right) && buffer > 0 && active_r < 0)
94
    {
95
        active_r = 10;
96
        songno += 1;
97
        if (songno > 3)
98
            songno = 0;
99
        if (gaster == 1)
100
            active_r = 2;
101
    }
102
    active_l -= 1;
103
    active_r -= 1;
104
    draw_set_color(c_white);
105
    if (active_l > 0)
106
        draw_set_color(c_yellow);
107
    draw_text(50, 200, "<<");
108
    draw_set_color(c_white);
109
    if (active_r > 0)
110
        draw_set_color(c_yellow);
111
    draw_text(580, 200, ">>");
112
    if (gaster == 1)
113
        g_timer += 1;
114
    if (g_timer >= 600)
115
    {
116
        audio_stop_all();
117
        con = 3;
118
    }
119
}
120
if (con == 3)
121
{
122
    draw_text(150, 50, 
Thanks for your feedback!#Be seeing you soon!
scr_gettext
scr_gettext

var text_id = argument[0]; var text = ds_map_find_value(global.text_data_en, text_id); if (is_undefined(text)) text = ""; if (global.language == "ja") { var loc_text = ds_map_find_value(global.text_data_ja, text_id); if (!is_undefined(loc_text)) text = loc_text; } for (var i = 1; i <= (string_length(text) - 3); i++) { if (string_copy(text, i, 2) == "\[" && string_char_at(text, i + 3) == "]") { var sel = string_char_at(text, i + 2); var replace; if (sel == "C") replace = global.charname; else if (sel == "G") replace = string(global.gold); else if (sel == "I") replace = global.itemname[global.menucoord[1]]; else if (sel == "1" && argument_count > 1) replace = argument[1]; else if (sel == "2" && argument_count > 2) replace = argument[2]; else if (sel == "3" && argument_count > 3) replace = argument[3]; else if (sel == "4" && argument_count > 4) replace = argument[4]; else if (sel == "5" && argument_count > 5) replace = argument[5]; else if (sel == "6" && argument_count > 6) replace = argument[6]; else if (sel == "7" && argument_count > 7) replace = argument[7]; else if (sel == "8" && argument_count > 8) replace = argument[8]; else if (sel == "9" && argument_count > 9) replace = argument[9]; else replace = ""; var before = string_copy(text, 1, i - 1); var after = string_copy(text, i + 4, string_length(text)); text = before + replace + after; i += (string_length(replace) - 1); } } return text;
("soundtest_thanks")
);
123
    seeya_timer += 1;
124
}