Advertisement
Guest User

Untitled

a guest
Feb 28th, 2015
335
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.14 KB | None | 0 0
  1. function locate():TPoint;
  2. var
  3. varrokStoneDist, varrokTreeDist, edgevilleStoneDist, edgevilleBankDist, edgevilleTreeDist, draynorStoneDist, draynorBankDist, draynorTreeDist, threshold:integer;
  4. t:TTimeMarker;
  5. p:TPoint;
  6. i:integer;
  7. location:string;
  8. label
  9. finalStep;
  10. begin
  11. if (not isLoggedIn()) then
  12. exit;
  13.  
  14. threshold := 50; //limit in TPoints for how far away we can be from a given location before we say we're not there
  15.  
  16. players[currentPlayer].location := 'to be decided';
  17.  
  18. t.start();
  19.  
  20. result := map.getPlayerPos();
  21.  
  22. if result.equals([-1, -1]) then
  23. begin
  24. writeDebug('Pos = -1, -1 for some reason.');
  25. exit;
  26. end
  27.  
  28. begin
  29. begin
  30. varrokStoneDist := distance(result, point(294, 770));
  31. varrokTreeDist := distance(result, point(474, 790));
  32. writeLn('Varrok Stone Dist: ' + toStr(varrokStoneDist) + ' Varrok Tree dist: ' + toStr(varrokTreeDist));
  33.  
  34. if(varrokStoneDist < threshold) THEN
  35. begin
  36. players[currentPlayer].location := 'varrokStone';
  37. goto finalStep;
  38. end;
  39.  
  40. if(varrokTreeDist < threshold) THEN
  41. begin
  42. players[currentPlayer].location := 'varrokTree';
  43. goto finalStep;
  44. end;
  45. end;
  46.  
  47. begin
  48. edgevilleStoneDist := distance(result, point(162, 162));
  49. edgevilleBankDist := distance(result, point(270, 202));
  50. edgevilleTreeDist := distance(result, point(278, 366));
  51. writeLn('Edgeville Stone Dist: ' + toStr(edgevilleStoneDist) + ' Edgeville Bank dist: ' + toStr(edgevilleBankDist) + ' Edgeville Tree dist: ' + toStr(edgevilleTreeDist));
  52.  
  53. if(edgevilleStoneDist < threshold) THEN
  54. begin
  55. players[currentPlayer].location := 'edgevilleStone';
  56. goto finalStep;
  57. end;
  58.  
  59. if(edgevilleBankDist < threshold) THEN
  60. begin
  61. players[currentPlayer].location := 'edgevilleBank';
  62. goto finalStep;
  63. end;
  64.  
  65. if(edgevilleTreeDist < threshold) THEN
  66. begin
  67. players[currentPlayer].location := 'edgevilleTree';
  68. goto finalStep;
  69. end;
  70. end;
  71.  
  72. begin
  73. draynorStoneDist := distance(result, point(958, 154));
  74. draynorBankDist := distance(result, point(906, 374));
  75. draynorTreeDist := distance(result, point(926, 478));
  76. writeLn('Draynor Stone Dist: ' + toStr(draynorStoneDist) + ' Draynor Bank dist: ' + toStr(draynorBankDist) + ' Draynor Tree dist: ' + toStr(draynorTreeDist));
  77.  
  78. if(draynorStoneDist < threshold) THEN
  79. begin
  80. players[currentPlayer].location := 'draynorStone';
  81. goto finalStep;
  82. end;
  83.  
  84. if(draynorBankDist < threshold) THEN
  85. begin
  86. players[currentPlayer].location := 'draynorBank';
  87. goto finalStep;
  88. end;
  89.  
  90. if(draynorTreeDist < threshold) THEN
  91. begin
  92. players[currentPlayer].location := 'draynorTree';
  93. goto finalStep;
  94. end;
  95. end;
  96.  
  97. if(players[currentPlayer].location = 'to be decided') THEN players[currentPlayer].location := 'unknown';
  98. end;
  99. finalStep:
  100. writeDebug('Our location is currently: ' + players[currentPlayer].location + ', took ' + toStr(t.getTime()) + ' ms.');
  101. end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement