SRL Archive - Help and Support

MMDots


Sin

2012-03-06 10:07:02

For my Giant Spider Killer, i'm currently relying on the very unefficient way of finding a spider on screen.
I'm adding a failsafe, and here it is currently -
procedure Attacking;
var
x,y,t:Integer;
NPC:TPoint;
begin
if FindSpider(x,y) then
begin
ClickMouse2(false);
WaitOption('ttack',1250);
if DidRedClick then
begin
repeat
wait(2000);
If TimeFrommark(t) > 6000 then
exit;
until(InFight);
if InFight then
writeln('In fight');
end;
end else
begin
if FindColorSpiralTolerance(NPC.x,NPC.y,65536,MMX1,MMy1,MMX2,MMY2,4) then
begin
Mouse(NPC.x,npc.y,1,1,True);
FFlag(1);
exit;
end;
end;
end;
It'll basically just find the yellow color on the minimap and go to it,
can someone help me with how GetMiniMapDots work?

weequ

2012-03-06 10:40:48


var
I: Integer;
Dots: TPointArray;
begin
Dots := GetMiniMapDots('npc');
for I := 0 to Length(Dots)-1 do
begin
WriteLn(ToStr(Dots[I]));
end;
end;
You could use SortTPAFrom(Dots, IntToPoint(MMCX, MMCY));

Edit: I also recommend using MMToMS Function for more accurate spider finding.

Sin

2012-03-06 10:44:15

From: weequ

var
I: Integer;
Dots: TPointArray;
begin
Dots := GetMiniMapDots('npc');
for I := 0 to Length(Dots)-1 do
begin
WriteLn(ToStr(Dots[I]));
end;
end;


Hmm, cleared up how to find the colors, but how would I incorporate it into my script?
FindColorSpiralTolerance?

weequ

2012-03-06 10:51:45

procedure Attacking;
var
x,y,t:Integer;
Dots: TPointArray
begin
if FindSpider(x,y) then
begin
ClickMouse2(false);
WaitOption('ttack',1250);
if DidRedClick then
begin
repeat
wait(2000);
If TimeFrommark(t) > 6000 then
exit;
until(InFight);
if InFight then
writeln('In fight');
end;
end else
begin
Dots := GetMinimapDots('npc');
if Length(Dots) > 0 then
begin
SortTPAFrom(Dots, IntToPoint(MMCX, MMCY));
Mouse(Dots[0].x,Dots[0].y,1,1,True);
FFlag(1);
exit;
end;
end;
end;

Didn't try if it works. Your method would be faster though because it doesn't find all the dots on the minimap.

Flight

2012-03-06 20:26:21


Function GetClosestMMDot(WhatDot: String): TPoint;
var
TPA: TPointArray;
begin
TPA := GetMiniMapDots(WhatDot);
if (Length(TPA) < 1) then
Exit;

SortTPAFrom(TPA, Point(MMCX, MMCY));
Result := TPA[0];
end;


TP := GetClosestMMDot('npc');
MouseFlag(TP.X, TP.Y, 3, 3, 1);