Log in

View Full Version : Issue with Color Finding?



insanomano
10-29-2011, 06:13 AM
** Problem Resolved **

I want to start off by saying it has been awhile since I have been to SRL, but I am glad the community is still going strong.

Anyways, I feel like getting back in to scripting and getting better at it, but I am having issues getting color finding procedures to work, mainly FindColorTolerance/ FindColor, I am attempting to write a simple powerminer to freshen my memory on scripting but it seems like Simba can't find colors on the RS client. here is a chunk of code I wrote up to drop iron

program PowerMiner;
//{$i srl/srl/misc/smart.scar}
{$i srl/srl.scar}

var
x, y: integer;

Procedure DIO;

begin
if not (FindColorTolerance(x, y, 1581111, MIX1, MIY1, MIX2, MIY2, 10)) then
begin
Writeln('Could not find ore');
exit;
end;
repeat
if(FindColorTolerance(x, y, 1581111, MIX1, MIY1, MIX2, MIY2, 10)) then
begin
Writeln('Found ore in inventory');
Mouse(x, y, 8, 8, false);
wait(500 + random(500));
ChooseOption('rop');
wait(1000 + random(1000));
end;
until not(FindColorTolerance(x, y, 1581111, MIX1, MIY1, MIX2, MIY2, 10));
end;





begin
SetupSRL;
ClearDebug;
ActivateClient;
DIO;
end.

I'm sure it is some obvious error I am making, I have tried searching for help but nothing was coming up, any help on this matter would be greatly appreciated.

EDIT 1: @ Flight: I haven't tried DTM's etc for item finding, I was just trying to put together something simple, and I haven't tried having my variables local in the procedure, didn't think that would make a difference but I shall try it out <-- this didn't make a difference. Also if it's any help I'm running Simba on a windows 7 OS

EDIT 2: @ euphemism: yea I dragged the cross-hair over top of RS in my browser (Google Chrome)

EDIT 3: Figured out the issue, booted up smart and used that as my client, color finding seemed to work, not sure why it wasn't working on Google Chrome, anyways, thanks for the help guys, it's appreciated

Flight
10-29-2011, 06:27 AM
Have you tried DTM/Bitmaps for item-finding? Also, I wonder if it would make a difference if X/Y were defined locally within your procedure.

euphemism
10-29-2011, 06:32 AM
Did you make the RS client the target client?

Flight
10-29-2011, 07:10 AM
I heard a post earlier about color alternating some between the RS client and SMART. But that would have to mean the difference is higher than your tolerance of 10. In any case, glad you figured it out.