
Originally Posted by
henryuscola
Hi , thanks for looking at my code yes when it finds the bitmap it moves mouse to it then I want it to search for a color to attack only if it's inside the pit. So far my script searches for the target color everywhere and not where the bitmap is found. I only want it to search for target colors when bitmap is found.
Easiest way to do that would be to tell the function to exit if the first bitmap isn't found, like so:
Simba Code:
function attack: integer;
var
x, y, Pit: integer;
begin
if FindBitmapToleranceIn(Pit, X, Y, 737, 263, 795, 335, 145) then //We we find this bitmap, then...
begin
MoveMouse(x, y); //Move the mouse to where we found it (don't click or anything though)
writeLn('inside pit');
end else exit; //I've added this bit here.
//If the bitmap is not found, we'll exit the routine.
if findColorTolerance(x, y, 3035181, 20, 59, 768, 413, 5) then //If we find this color(?)
begin
writeLn('target found'); //I guess the above color is of a monster to attack?
MoveMouse(x, y); //Move the mouse, wait 2 seconds and then click? I hope the target isn't moving...
wait(2000);
ClickMouse(x, y, MOUSE_LEFT);
wait(2000)
end else writeln('target not found, not in pit');
end;