Undertale Yellow script viewer

← back to main script listing

gml_GlobalScript_tile_get_id

(view raw script w/o annotations or w/e)
1
function tile_get_id(argument0) //gml_Script_tile_get_id
2
{
3
    var __index = argument0
4
    var __currtile = 0
5
    var __layers = layer_get_all()
6
    var __numlayers = array_length_1d(__layers)
7
    for (var __i = 0; __i < __numlayers; __i++)
8
    {
9
        var __els = layer_get_all_elements(__layers[__i])
10
        var __numels = array_length_1d(__els)
11
        for (var __j = 0; __j < __numels; __j++)
12
        {
13
            var __eltype = layer_get_element_type(__els[__j])
14
            if (__eltype == 7)
15
            {
16
                if (__currtile == __index)
17
                    return __els[__j];
18
                __currtile++
19
            }
20
        }
21
    }
22
    return -1;
23
}