tarajunky
2006-05-25 12:35:21
I wrote up this code to use in conjunction with RadialWalk.
Since RS now changes river/road colors every time the screen loads you can't just pick one color and let it walk to the destination.
This procedure just allows you to search along a line on the minimap until you find a color that is similar to a road color and then sets that as the new road color. You can have it search along any direction by specifying the Increment value. So, -1,-1 will go NW. -3,1 would go WSW, etc.
I haven't really optimized the starting road or river colors yet, but the ones I have used so far are 5592411 with 50 tolerance for the road and 10909795 with 50 tolerance for the rivers.
Since RS now changes river/road colors every time the screen loads you can't just pick one color and let it walk to the destination.
This procedure just allows you to search along a line on the minimap until you find a color that is similar to a road color and then sets that as the new road color. You can have it search along any direction by specifying the Increment value. So, -1,-1 will go NW. -3,1 would go WSW, etc.
I haven't really optimized the starting road or river colors yet, but the ones I have used so far are 5592411 with 50 tolerance for the road and 10909795 with 50 tolerance for the rivers.
Function FindWalkingColor(StartX,StartY,IncX,IncY,Color,Tol:integer):integer;
var testcolor:integer;
begin
TestColor:=0;
Repeat;
StartX:=StartX+IncX;
StartY:=StartY+IncY;
TestColor:=GetColor(StartX,StartY);
If SimilarColors(TestColor,Color,Tol) then
begin
Result:=TestColor;
Break;
end;
Until (x>=720) or (x<=540) or (y<=20) or (y>=160);
end;