Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function locate():TPoint;
- var
- varrokStoneDist, varrokTreeDist, edgevilleStoneDist, edgevilleBankDist, edgevilleTreeDist, draynorStoneDist, draynorBankDist, draynorTreeDist, threshold:integer;
- t:TTimeMarker;
- p:TPoint;
- i:integer;
- location:string;
- label
- finalStep;
- begin
- if (not isLoggedIn()) then
- exit;
- threshold := 50; //limit in TPoints for how far away we can be from a given location before we say we're not there
- players[currentPlayer].location := 'to be decided';
- t.start();
- result := map.getPlayerPos();
- if result.equals([-1, -1]) then
- begin
- writeDebug('Pos = -1, -1 for some reason.');
- exit;
- end
- begin
- begin
- varrokStoneDist := distance(result, point(294, 770));
- varrokTreeDist := distance(result, point(474, 790));
- writeLn('Varrok Stone Dist: ' + toStr(varrokStoneDist) + ' Varrok Tree dist: ' + toStr(varrokTreeDist));
- if(varrokStoneDist < threshold) THEN
- begin
- players[currentPlayer].location := 'varrokStone';
- goto finalStep;
- end;
- if(varrokTreeDist < threshold) THEN
- begin
- players[currentPlayer].location := 'varrokTree';
- goto finalStep;
- end;
- end;
- begin
- edgevilleStoneDist := distance(result, point(162, 162));
- edgevilleBankDist := distance(result, point(270, 202));
- edgevilleTreeDist := distance(result, point(278, 366));
- writeLn('Edgeville Stone Dist: ' + toStr(edgevilleStoneDist) + ' Edgeville Bank dist: ' + toStr(edgevilleBankDist) + ' Edgeville Tree dist: ' + toStr(edgevilleTreeDist));
- if(edgevilleStoneDist < threshold) THEN
- begin
- players[currentPlayer].location := 'edgevilleStone';
- goto finalStep;
- end;
- if(edgevilleBankDist < threshold) THEN
- begin
- players[currentPlayer].location := 'edgevilleBank';
- goto finalStep;
- end;
- if(edgevilleTreeDist < threshold) THEN
- begin
- players[currentPlayer].location := 'edgevilleTree';
- goto finalStep;
- end;
- end;
- begin
- draynorStoneDist := distance(result, point(958, 154));
- draynorBankDist := distance(result, point(906, 374));
- draynorTreeDist := distance(result, point(926, 478));
- writeLn('Draynor Stone Dist: ' + toStr(draynorStoneDist) + ' Draynor Bank dist: ' + toStr(draynorBankDist) + ' Draynor Tree dist: ' + toStr(draynorTreeDist));
- if(draynorStoneDist < threshold) THEN
- begin
- players[currentPlayer].location := 'draynorStone';
- goto finalStep;
- end;
- if(draynorBankDist < threshold) THEN
- begin
- players[currentPlayer].location := 'draynorBank';
- goto finalStep;
- end;
- if(draynorTreeDist < threshold) THEN
- begin
- players[currentPlayer].location := 'draynorTree';
- goto finalStep;
- end;
- end;
- if(players[currentPlayer].location = 'to be decided') THEN players[currentPlayer].location := 'unknown';
- end;
- finalStep:
- writeDebug('Our location is currently: ' + players[currentPlayer].location + ', took ' + toStr(t.getTime()) + ' ms.');
- end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement