Doom989 Posted October 3, 2012 Share Posted October 3, 2012 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. Quote Link to comment Share on other sites More sharing options...
LordJashin Posted October 3, 2012 Share Posted October 3, 2012 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. Quote Link to comment Share on other sites More sharing options...
Doom989 Posted October 3, 2012 Author Share Posted October 3, 2012 Thank you so much, works perfectly. Also thank you for the link! Quote Link to comment Share on other sites More sharing options...
LordJashin Posted October 3, 2012 Share Posted October 3, 2012 There is more in the tutorial section, and I just updated OSI to include an Examples folder which holds tons of examples for SCAR Divi & SCAR Divi form components here. There isn't examples on everything, but a wide misc amount of stuff. I personally like the VCL folder and the examples in there... Quote Link to comment Share on other sites More sharing options...