This has been an idea of mine (and im sure many others) for quite some time. I was just never able to actually hammer it out til now. I was writing up an area recognition routine for my new hunting script and ran into a few issues. Through the process of resolving it, i stumbled across this solution! First i came up with a way to return N/E/W/S or NE/NW/SE/SW/etc from one location to another (character position to an object). I then set the object to lord british's throne, figure out how many steps and in which direction i am, an boom! a couple calculations/guesses later and i had my data. This is a quick and dirty example of finding long/lat simple based off an X/Y coordinate!
gosub Header
repeat
if #CHARPOSX <> %LastX || #CHARPOSY <> %LastY
{
set %LastX #CHARPOSX
set %LastY #CHARPOSY
set %xyz #CHARPOSX , X , #SPC , #CHARPOSY , Y , #SPC , #CHARPOSZ , Z
menu set xyz %xyz
}
gosub FindLongLat #CHARPOSX #CHARPOSY
wait 5
until #FALSE
sub FindLongLat
set %long_dir
set %lat_dir
set %CenterX 1323
set %CenterY 1624
set %long_time 3168
set %lat_time 2531
set %FindX %1
set %FindY %2
set %fx ( %FindX - %CenterX )
set %fy ( %FindY - %CenterY )
set #RESULT #FALSE
if %fy > 0
set %long_dir %long_dir , S
else
set %long_dir %long_dir , N
set %steps %fy ABS
if %fx > 0
set %lat_dir %lat_dir , E
else
set %lat_dir %lat_dir , W
set %steps2 %fx ABS
set %seconds ( ( %steps * %long_time ) ) ;3165
set %seconds2 ( ( %steps2 * %lat_time ) ) ;2531
set %lathrs ( %seconds / ( 60 * 60 ) / 10 )
set %latmin ( ( %seconds / 600 ) - ( %lathrs * 60 ) )
set %lonhrs ( %seconds2 / ( 60 * 60 ) / 10 )
set %lonmin ( ( %seconds2 / 600 ) - ( %lonhrs * 60 ) )
menu set longlat %lathrs , o , #SPC , %latmin , ' , %long_dir , #SPC , %lonhrs , o , #SPC , %lonmin , ' , %lat_dir
return %return
sub Header
menu Clear
menu Window Title Altiric's Sextant
menu Window Size 275 50 ;250 245
menu font name Verdana
menu font align right
menu text lab1 85 5 Sextant:
menu text lab2 85 20 XYZ:
menu font align left
menu text longlat 90 5
menu text xyz 90 20
menu Show 500 270
return
this will only work in Tram/Fel unless you update the center X/Y to the different maps.[