Jump to content
Doom989

findcolor help

Recommended Posts

Hey, I've been trying to get this to check for a color, and if it's there to click it and if it isn't, to skip past the clicks and waits. But for some reason it does so every time.

I would be very appreciative if anyone could give me some help or advice, thank you.

 

var x,y: integer;
begin
findcolor(x,y,10206916,670,617,675,622)
if(x<>0 )then
ClickMouse(670, 617, mbleft);
 wait(1500) 
ClickMouse(640,748, mbleft);
 wait(1500)
end.

Link to comment
Share on other sites

Hey, I've been trying to get this to check for a color, and if it's there to click it and if it isn't, to skip past the clicks and waits. But for some reason it does so every time.

I would be very appreciative if anyone could give me some help or advice, thank you.

 

var x,y: integer;
begin
findcolor(x,y,10206916,670,617,675,622)
if(x<>0 )then
ClickMouse(670, 617, mbleft);
 wait(1500) 
ClickMouse(640,748, mbleft);
 wait(1500)
end.

 

Very simple, you need Begin..end blocks. How will SCAR or Pascal know if you mean all the lines after if (x<>0) then? It doesn't know, so you need to include all of it not just the line under that if statement.

 

Try this in SCAR:

[sCAR]

program test;

var x,y: Integer;

 

begin

if findcolor(x,y,10206916,670,617,675,622) then

begin

ClickMouse(670, 617, mbleft);

wait(1500)

ClickMouse(640,748, mbleft);

wait(1500)

end;

end.

[/sCAR]

 

Infinite loop version:

[scar]

program test;

var x,y: Integer;

 

begin

Repeat

if findcolor(x,y,10206916,670,617,675,622) then

begin

ClickMouse(670, 617, mbleft);

wait(1500)

ClickMouse(640,748, mbleft);

wait(1500)

end;

until false;

end.

[/scar]

 

SCAR beginner tutorial/guide here.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
  • Create New...