Undertale Yellow script viewer

← back to main script listing

gml_GlobalScript_scr_mail_add

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

function scr_mail_add(arg0) { ds_list_add(global.mail_list, arg0); if (irandom(global.spam_mail_chance) == 1) { show_debug_message("success"); ds_list_add(global.mail_list, choose("Spam Letter 1", "Spam Letter 2", "Spam Letter 3", "Spam Letter 4", "Spam Letter 5", "Spam Letter 6", "Spam Letter 7", "Spam Letter 8", "Spam Letter 9")); global.spam_mail_chance = 30; } else { global.spam_mail_chance = clamp(global.spam_mail_chance - 1, 1, 999); } scr_mail_sort(); }
(arg0)
2
{
3
    ds_list_add(global.mail_list, arg0);
4
    if (irandom(global.spam_mail_chance) == 1)
5
    {
6
        show_debug_message("success");
7
        ds_list_add(global.mail_list, choose("Spam Letter 1", "Spam Letter 2", "Spam Letter 3", "Spam Letter 4", "Spam Letter 5", "Spam Letter 6", "Spam Letter 7", "Spam Letter 8", "Spam Letter 9"));
8
        global.spam_mail_chance = 30;
9
    }
10
    else
11
    {
12
        global.spam_mail_chance = clamp(global.spam_mail_chance - 1, 1, 999);
13
    }
14
    scr_mail_sort
scr_mail_sort

function scr_mail_sort() { var old_pinned = ""; if (global.mail_pinned == true) { old_pinned = ds_list_find_value(global.mail_list, 0); ds_list_delete(global.mail_list, 0); } ds_list_sort(global.mail_list, false); if (old_pinned != "") ds_list_insert(global.mail_list, 0, old_pinned); }
();
15
}