EDIT: [THIS ISSUE HAS BEEN FIXED!]
Hi Everyone!
I've been working on this new feature for a few hours, trying to get it right. I've got an idea of searching for a really accurate location of the macroing player, by opening up the World Map, and locating the "You Are Here" position and then using trigonometry to finding distances in pixels between that and name of the closest city. (please ask me to expand if your hacing difficulty understanding, I might just post pictures to guide you.) I've got as far as, getting client's DC screen, copying it onto the canvas and then getting my bitmap of the arrow and trying to locate it. The problem I'm getting is that it hangs on trying to search for the bitmap, and just hangs then crashes SCAR 3.15b....
WORKING CODE!
SCAR Code:
{------------------------------------------------------------------------------------------------------------------------------
Script: Location Finder [BETA]
By: Nadeem (Canvas idea from Wizzup?)
Note: This only finds the arrow, I will be using this to find Accurate player positioning.
------------------------------------------------------------------------------------------------------------------------------}
var
x, y, bmpLoc, ClientBMP: Integer;
function FindMe(var x, y: Integer): Boolean;
var
DC: HDC;
begin
try
Status('Finding Bitmap');
DC := GetTargetDC;
bmpLoc := BitmapFromString(37, 35, 'beNrFlz0OwjAMhbNwKW7DFZ' +
'jZWHoODsLOxsAlYKoYqSi4etVrlCZOSMFUHqrG9tfEL3/OBc9mvYK5ZU9hHnE' +
'4bp1YNRSBTJJ1Pu0cnD+F+iAxyVMSC6JvX4yKDjJi74fREJuComnuH6Wg+1EH' +
'+X69uFebhAYg8RT/eclYIH+0deLjNhhHiSAxNGVZbGIHAyJxYn3/fHWNpD3vp' +
'+rI+wDqGmmFW4DjL/nfiZMBCdQYJbJGCovjhipEf0OaEDX/mYnYjmOLlxQLSe' +
'R7SjnAoQTRcBJ9050hs+ikqCBWs+iMimRTlTigysoSgQ7qAmBCnQVRZVekcuJ' +
'yFnHjhFKFp0iX07N8sYVmFEmkJJRVSAoHzaSIKblCIRU4g94Z185SmcbzznJV' +
'sVwzjXcEy/3OeDe3PKsYn8Tsz5mWp2jjO8J/b0D297sf3l7fk5g7BQ==');
SetTransparentColor(bmpLoc, 0);
ClientBMP := BitmapFromString(765, 500, '');
CopyClientToBitmap(ClientBMP, 0, 0, 500, 765);
SafeDrawBitmap(ClientBMP, GetDebugCanvas, 0, 0);
SetTargetDC(GetBitmapDC(ClientBMP));
if FindBitmapSpiralTolerance(bmpLoc, x, y, 0, 0, 765, 500, 39) then
begin
IncEx(x, 19);
IncEx(y, 18);
Result := True;
end;
except
Writeln('Unable to find location arrow...');
finally
SetTargetDC(DC);
FreeBitmap(ClientBMP);
FreeBitmap(bmpLoc);
end;
end;
procedure ScriptTerminate;
begin
FreeBitmap(ClientBMP);
FreeBitmap(bmpLoc);
end;
begin
if FindMe(x, y) then
Writeln('Found Points Centered: ' + IntToStr(x) + ', ' + IntToStr(y))
else
Writeln('None found.');
end.