set %destx *testx . 13 set %desty *testy . 13 set %curx #charposx set %cury #charposy Loop: set %curx #charposx set %cury #charposy if %curx = %destx && %cury = %desty halt for %i 1 20 { set %newx *testx . %i set %newy *testy . %i ;if %newx > %curx + 8 || %newx < %curx - 8 || %newy > %cury + 8 || %newy < %cury - 8 ;continue ;=================================== set %destx1 %curx - %destx if %destx1 < 0 set %destx1 %destx1 * -1 set %desty1 %cury - %desty if %desty1 < 0 set %desty1 %desty1 * -1 if %destx1 > %desy1 set %maxdist %destx1 else set %maxdist %desty1 ;==================================== set %destx2 %newx - %destx if %destx2 < 0 set %destx2 %destx2 * -1 set %desty2 %newy - %desty if %desty2 < 0 set %desty2 %desty2 * -1 if %destx2 > %desy2 set %maxdist2 %destx2 else set %maxdist2 %desty2 ;===================================== if %maxdist < %maxdist2 { msg %i %maxdist %maxdist2 $ move %newx %newy 0 10s break } } Goto Loop