SRL Archive - OSR Help

Rock colors help for powerminer


mcbain

2013-02-23 19:27:06

I am making a power miner script for Rs07, but my rock colors aren't working out very well. I've tried many variations on the rock colors for tin but my colorfinder function is still have a lot of problems finding the darn rock. Usually finds anything white, or tin ore thats been mined already and dropped on the floor :(


Here is my code:


program new;
{$I SRL/SRL.Simba}
{$I P07Include.Simba}
var
x,y,tin,drop:integer;
const

hue_ore = 0.70;
sat_ore = 0.33;
Procedure P07_DeclarePlayer;
Begin
P07_PlayerName:='';
P07_PlayerPass:='';
End;
Function Moving: Boolean;
var
MovingBox: Tbox;
begin
MovingBox := IntToBox(232, 146, 291, 191);
Result := (AveragePixelShift(MovingBox, 200, 400) > 70);
Writeln(IntToStr(AveragePixelShift(MovingBox, 250, 500)));
end;
//This is my rock color finder function:

Function Clickrock:boolean;
var


TPA : TpointArray;
ATPA : T2DPointArray;

i, l, xas, yas,tmpCTS : integer;
begin
tmpCTS := GetToleranceSpeed;
SetColorToleranceSpeed(2);

SetToleranceSpeed2Modifiers(hue_ore, sat_ore);
FindColorsTolerance(TPA, 8421514, P07_MSX1, P07_MSY1, P07_MSX2, P07_MSY2, 5);
SplitTPAWrap(TPA, 10, ATPA);

SortATPAFromFirstPoint(ATPA, Point(MSCX,MSCY));
SetColorToleranceSpeed(tmpCTS);
SetToleranceSpeed2Modifiers(0.02, 0.02);
if Length(TPA) > 0 then
begin
SortTPAFrom(TPA, Point(P07_MSCX, P07_MSCY));
ATPA := TPAToATPAEx(TPA, 17, 10);
L := High(ATPA)
for i := 0 to L do
if Length(ATPA[i]) > 0 then
begin
MiddleTPAEx(ATPA[i], xas, yas);
MMouse(xas, yas, 3, 3);
Wait(randomrange(50,500));
if P07_IsUpTextMultiCustom(['ine']) then
begin
clickmouse2(mouse_left);
end;
result := true;
exit;
end;
end;
end;
//end of color function.
Procedure DropOres;
Begin
If (Not P07_LoggedIn) Then
Begin
P07_LogInPlayer;
End;
P07_DropAll;
End;

procedure lookandmine;
begin
If (Not P07_LoggedIn) Then
Begin
P07_LogInPlayer;
End;
if P07_InvFull then
begin
writeln('we are full bra');
dropores;
end;
clickrock;

end;
begin
P07_DeclarePlayer;
SetupP07Include;
MouseSpeed := 15;
ActivateClient;
repeat
lookandmine;
until (IsKeyDown(114));
end.


Is there anything im doing wrong in the function? or have i just not found a specific enough color?

Any help will be greatly appreciated :)

thanks,

Mcbain.

Ian

2013-02-23 20:05:24

Use ACA.

mcbain

2013-02-23 20:12:23

From: BMWxi
Use ACA.


All the colors i use have been found from ACA, maybe ill actually use the ACA function maker and see if that makes a difference.

Ian

2013-02-23 20:15:09

From: mcbain
All the colors i use have been found from ACA, maybe ill actually use the ACA function maker and see if that makes a difference.


Did you use the tolerance that ACA gave you?

mcbain

2013-02-23 20:19:07

From: BMWxi
Did you use the tolerance that ACA gave you?


Ohhhh son of a gun..I did not haha! there lies the error i'm sure, i was fairly confident that my function wasn't the problem :p

Nations_collapse

2013-02-24 02:05:36

What is this ACA?

Sjoe

2013-02-24 02:10:31

From: Nations_collapse
What is this ACA?


AutoColorAid ;)

Sax

2013-02-24 06:38:32

From: Nations_collapse
What is this ACA?


It is a tool that helps you find colors more accurately. You should always use it when the color you want to find looks like other things in the background.

Link: http://villavu.com/forum/showthread.php?t=26944&highlight=autocoloraid

Runehack123

2013-02-24 06:51:27

SplitTPAWrap(TPA, 10, ATPA); << Why?

By the way, your tolerance is very low and I don't recommend using the ACA tolerance value. Try using it as a guideline if anything and see how that works.

Sax

2013-02-24 08:20:32

I have a private iron miner but it is for EOC RuneScape and it is working fine. If you want to take a look at my code, PM me.