Clicking ColoursBack to TopNow I can’t really explain much here. Basically, as the name suggests, this section is about using a colour on the minimap to click and hopefully walk somewhere. Pretty simple?… It should be. The only function(s) you would need are FindColor, FindColorTolerance and FindColorSpiralTolerance. There are more which you could use to get more accurate points but for now I’ll explain these.
I’m not going to explain the parameters for these functions because you should already know them. You should also already know the difference between the 3 functions above. In a nutshell – FindColor finds a colour and stores the coordinates with
NO tolerance. FindColorTolerance is the same as FindColor except you can specify a tolerance so the colour doesn’t have to be exact. FindColorSpiralTolerance is the same as FindColorTolerance except it searches for the colour starting from the points stored in your variables.
By using these functions, you can get the coords of the first colour point found. (FindColor and FindColorTolerance search from left to right, up to down. FindColorSpiralTolerance searches from the points stored in your x, y variables). Now that you have the coordinates, you can just use a quick call to Mouse to make it click. Simple as that.
Examples:
if (FindColor(x, y, DoorColour, MMX1, MMY1, MMX2, MMY2)) then
Mouse(x, y, 0, 0, True);
if (FindColorTolerance(x, y, 2917530, MMX1, MMY1, MMX2, MMY2, 10)) then
Mouse(x, y, 0, 0, True);
x := MMCX;
y := MMCY;
if (FindColorSpiralTolerance(x, y, LadderColour, MMX1, MMY1, MMX2, MMY2, 5)) then
Mouse(x, y, 0, 0, True);
Notice in the last example I set x and y to the coords of the minimap centre. When I call FindColorSpiralTolerance, it will start searching from the coords in x and y (MMCX, MMCY) thus finding the closest ladder first. It’s very useful for finding colours close to you (on the mainscreen like trees, mining rock, etc.).
If you look at this screenie here:

If you use FindColorTolerance for the red drop dot colour, the one on the left would be found first. If you used FindColorSpiralTolerance however, the one to the right would be found first (provided that x and y have the minimap centre stored in them).
Another way of using colours to map walk is similar to the way I used symbols. You could use a repeat loop that repeats until it find a colour. ie:
repeat
RadialWalk(RoadColor, 70, 100, 65, -1, 0);
until(FindColor(x, y, 255, MMX1, MMY1, MMCx, MMY2));
This method is useful for walking to a part of the map where there are no symbols or suitable DTMs for detecting when to stop. In my RM Runner I use a method similar to this when I'm walking west towards Fally. I repeat my RadialWalk until the script find a white colour that symbolises the wall that leads up to Barbarian Village.
Although I emphasized this section on the three functions above, I think I should mention a couple of others:
- FindColorsTolerance – notice the ‘s’ after Color. Basically it works in the same way as FindColorTolerance except it stores all coordinates of all points where the colour is found into a TPointArray. One use for this would be to find the average of all the x values and the y values thus effectively “clicking in the middle of the points”. Here’s a little function I quickly made (not sure if it will work):
function FindMiddle(var cx, cy: Integer; Colour, x1, y1, x2, y2, Tol: Integer): Boolean;
var
Temp: TPointArray;
Sum: TPoint;
i, Length: Integer;
begin
Sum.x := 0; Sum.y := 0;
FindColorsTolerance(Temp, Colour, x1, y1, x2, y2, Tol);
Length := GetArrayLength(Temp);
for i := 0 to Length - 1 do
begin
Sum.x := Sum.x + Temp[i].x;
Sum.y := Sum.y + Temp[i].y;
end;
cx := Round(Sum.x / Length);
cy := Round(Sum.y / Length);
Result := (cx > 0) and (cy > 0);
end;
To use it you would do something like:
if (FindMiddle(x, y, DoorColour, MMX1, MMY1, MMX2, MMY2, 5)) then
Mouse(x, y, 0, 0, True);
- Here’s one of my personal function I’ve made for my RM Runner. It’s called GetDoorCoords and it basically stores the coords all doors on the minimap. It only stores one point per door and ignores drop dots.
function GetDoorCoords(var Points: TPointArray): Boolean;
var
i, j, k, m, Tempx, Tempy: Integer;
DoorColours1, DoorColours2: TPointArray;
begin
if (DoorColour = 0) then
DoorColour := FindDoorColour;
if (DoorColour = 0) then Exit;
FindColorsTolerance(DoorColours1, DoorColour, MMX1, MMY1, MMX2, MMY2, 0);
WriteDebug('Got ' + IntToStr(GetArrayLength(DoorColours1)) + ' DoorColour pixels');
i := 0;
for j := 0 to GetArrayLength(DoorColours1) - 1 do
begin
if (FindColor(Tempx, Tempy, DoorColour, DoorColours1[j].x - 1, DoorColours1[j].y - 1,
DoorColours1[j].x + 1, DoorColours1[j].y - 1)) or
(FindColor(Tempx, Tempy, DoorColour, DoorColours1[j].x - 1, DoorColours1[j].y,
DoorColours1[j].x - 1, DoorColours1[j].y)) or
(FindColor(Tempx, Tempy, DoorColour, DoorColours1[j].x - 1, DoorColours1[j].y + 1,
DoorColours1[j].x + 1, DoorColours1[j].y + 1)) or
(FindColor(Tempx, Tempy, DoorColour, DoorColours1[j].x + 1, DoorColours1[j].y,
DoorColours1[j].x + 1, DoorColours1[j].y)) then
begin
SetArrayLength(DoorColours2, i + 1);
DoorColours2[i].x := DoorColours1[j].x;
DoorColours2[i].y := DoorColours1[j].y;
i := i + 1;
end;
end;
WriteDebug('Got ' + IntToStr(GetArrayLength(DoorColours2)) + ' Door points');
i := 0;
m := 0;
repeat
for k := m to GetArrayLength(DoorColours2) - 2 do
begin
if (Distance(DoorColours2[k].x, DoorColours2[k].y, DoorColours2[k + 1].x,
DoorColours2[k + 1].y) > 8) or (k + 1 = GetArrayLength(DoorColours2) - 1) then
begin
SetArrayLength(Points, i + 1);
Points[i] := DoorColours2[k];
i := i + 1;
Break;
end;
end;
m := k + 1;
until(m >= GetArrayLength(DoorColours2) - 1);
WriteDebug('Got ' + IntToStr(GetArrayLength(Points)) + ' Doors');
if (GetArrayLength(Points) > 0) then
Result := True;
end;
Now that you have all the doors you can make it click in the middle of them using my function above.
That’s it for Colour Clicking. Never thought I would be able to expand FindColor into 2 and a half pages but then again I never thought I would feel like explaining so much. :p. So now for the more advanced sections – DDTM’s and DTM’s. :D.