set %xlocation #charposx + 1237 ; 1237 moves from brit's throne to the center of map
set %ylocation #charposy + 424 ; 424 moves from brit's throne to center of map
; Next check are we above 5120 for X or 4096 for y? if so, then readjust:
if %xlocation > 5120
set %xlocation %xlocation - 5120
if %ylocation > 4096
set %ylocation %ylocation - 4096
; Now xlocation and ylocation are in the right quadrant for creating the latitude and longitude references
if %xlocation < 2560
set %xdir W
else
set %xdir E
if %ylocation < 2048
set %ydir N
else
set %ydir S
set %xlocation %xlocation - 2560 abs
set %ylocation %ylocation - 2048 abs
set %lontemp %xlocation * 180 * 60 / 2560 ; 180 deg * 60 min / tiles equal to 180 deg E/W
set %lattemp %ylocation * 180 * 60 / 2048 ; 180 deg * 60 min / tiles equal to 180 deg N/S
set %longdeg %lontemp / 60
set %longmin %lontemp % 60
set %latdeg %lattemp / 60
set %latmin %lattemp % 60
display ok %latdeg , #spc , %latmin , %ydir , #spc , %longdeg , #spc , %longmin , %xdir
halt