Undertale Yellow script viewer

← back to main script listing

gml_GlobalScript_map

(view raw script w/o annotations or w/e)
1
function map() //gml_Script_map
2
{
3
    var __val = argument[0]
4
    __val -= argument[1]
5
    if (argument[1] != argument[2] && argument[3] != argument[4])
6
        __val = __val / (argument[2] - argument[1]) * (argument[4] - argument[3])
7
    __val += argument[3]
8
    if (argument_count > 5 && argument[5])
9
        __val = clamp(__val, min(argument[3], argument[4]), max(argument[3], argument[4]))
10
    return __val;
11
}