SRL Archive - Help and Support

Finding Start Coords


gerauchert

2007-11-29 22:10:15

Im trying to find starting location coords for my ranger script in order to more accurately detect the hp bar over my chars. To do this i figured that i would just make a function to find the color of the bow in the inv and then use that color to find it on the mainscreen. This worked okay the first couple of times, but now it will find other colors before it reaches the bow…

Is there a way to start searching from the center outward instead of from the top left corner of the MS?

This is what I have thus far :eek:

Function FindCenterCoords: Boolean;
begin
if(not(LoggedIn))then
Exit;
begin
Status('Getting bow colors');
GameTab(5);
Wait(500 + random(150));
BowColor1 := GetColor(593,302);
BowColor2 := GetColor(581,310);
BowColor3 := GetColor(574,311);
Writeln('BowColors are: ' + IntToStr(BowColor1) +' '+ IntToStr(BowColor2)
+' '+ IntToStr(BowColor3));
GameTab(4);
Status('Finding player coords');
if(FindColorSpiralTolerance(fx,fy,BowColor1,MSX1,MSY1,MSX2,MSY2,0))then
begin
MMouse(fx,fy,0,0);
Writeln('Player coords found at (' + IntToStr(fx) + ', ' + IntToStr(fy) + ')');
Result := True;
Exit;
end else
if(FindColorSpiralTolerance(fx,fy,BowColor2,MSX1,MSY1,MSX2,MSY2,0))then
begin
MMouse(fx,fy,0,0);
Writeln('Player coords found at (' + IntToStr(fx) + ', ' + IntToStr(fy) + ')');
Result := True;
Exit;
end else
if(FindColorSpiralTolerance(fx,fy,BowColor3,MSX1,MSY1,MSX2,MSY2,0))then
begin
MMouse(fx,fy,0,0);
Writeln('Player coords found at (' + IntToStr(fx) + ', ' + IntToStr(fy) + ')');
Result := True;
Exit;
end;
Status('BowFinding Failed...switching');
Result := False;
Writeln('Could not find bow color, Next Player');
NextPlayer(False);
end;
end;

Infantry001

2007-11-29 22:13:50

Set fx/fy to MSCX and MSCY before searching.

FindColorSpiral (and all other forms of it) will search from the returned variables initial input and spiral outwards.

gerauchert

2007-11-29 22:18:38

From: Infintry001
Set fx/fy to MSCX and MSCY before searching.

FindColorSpiral (and all other forms of it) will search from the returned variables initial input and spiral outwards.


oo i see, i always thought that they would spiral outward from the center naturally and thats where i was confused :redface:

thanks man this will help alot :D