Well here's what I got, doesn't work very well:
function mHighestCommonDenominator(%x,%y)
{
if(%x == %y)
return %x;
while(%x != 0 && %y != 0)
{
%ox = %x;
%oy = %y;
%x = %oy % %ox;
%y = %ox;
echo(%ox SPC %oy);
}
return %x == 0 ? %y : %x;
}
function getRatio(%width,%height)
{
%ratio = %width / %height;
%lhs = getSubStr(%ratio,0,7); //get the first 5 digits, ie. 0.*****
%lhs *= 100;
%rhs = getSubStr(%ratio,0,5); //first 3 digits
%rational = %lhs - %rhs; //%rational / 99 now == %ratio
%denominator = mHighestCommonDenominator(mFloatLength(%rational,0),99);
return mFloatLength(%rational / %denominator,0) @ ":" @ 99 / %denominator;
//works for widescreens if I do return mFloatLength(%rational / 11,0) @ ":" @ 9;
}
Also, so you know, getRes is already defined by the game.