SRL Archive - OSR Help

AutoColour Failing HELP!!


Runehack123

2013-01-21 13:04:16

Trying to get my script to find logs on lumbridge castle top floor using MMtoMS then creating TBox and then TPA/ATPA colour finding.

Maybe it's just me, but my method just fails…

And I don't understand why! I've tried doubling my tolerance from 15 to 30..even used 50, but it's doing things I don't want it to do. Tried changing the TBox..larger, smaller values. No idea what's going on, but it's just not working how I was hoping it would.

Any advice on how to improve my code and object finding would be really appreciated.

Here is a picture of the results I got using ACA tool on my last try when the mouse just moved towards the fire seen in the picture?!?!?!?!? How is that even possible! That fire has no red dot on MM:
http://i.imgur.com/2NGomWs.jpg

My code:
Function FindFloorItems: Boolean;

Var
ItemBox: TBox;
LogColours, RDots: TPointArray;
ATPA: T2DPointArray;
i, H, ii, HH, CTS: Integer;
MSItem, ItemPoint: TPoint;
Begin
Result := False;
RDots := GetMMDotsOnMS('r');

If (Length(RDots) < 1) Then
Begin
If Debug Then
Writeln('FindFloorItems - No red dots found on MM.');
Exit;
End;

SortTPAFrom(RDots, Point(MMCX, MMCY));
H := High(RDots);
For i := 0 To H Do
Begin
ItemPoint := MMtoMS(RDots[i]); //Pass all points of RDots to MMtoMS and assign to TPoints
If (ItemPoint.x = -1) And (ItemPoint.y = -1) Then
Continue;
With ItemPoint Do
ItemBox := IntToBox(Max(X - 20, MSX1), Max(Y - 20, MSY1), Min(X + 30, MSX2), Min(Y + 14, MSY2)); //Create TBox around item
End;

CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.23, 0.70);
FindColorsTolerance(LogColours, 2967378, ItemBox.X1, ItemBox.Y1, ItemBox.X2, ItemBox.Y2, 30);
SetColorSpeed2Modifiers(0.2, 0.2);
ColorToleranceSpeed(CTS);
ATPA := SplitTPAEx(LogColours, 10, 5);
SortATPASize(ATPA, True);

If (Length(LogColours) < 1) Then
Begin
If Debug Then
Writeln('Logs on floor colours not found.');
Exit;
End;

SetLength(RDots,0);

HH := High(ATPA);
for ii := 0 to HH do
begin
MSItem := MiddleTPA(ATPA[ii]);
MMouse(MSItem.X, MSItem.Y, 0, 0);
If WaitUpTextMulti(['Take', 'ke Lo','Logs'], 200) then
Begin
ClickMouse2(False);
If OptionsExist(['se Fi','ine F','Fire'], False) Then
Begin
If Debug Then
Writeln('Found Use Fire Examine Fire option');
If ChooseOptionMulti(['Use F','se Fir']) Then
If Debug Then
Writeln('Found ChooseOption light logs');
Result:= True;
Break;
End
Else
If ChooseOptionMulti(['ight L','t Log','Light']) Then
If Debug Then
Writeln('Found ChooseOption light logs');
Result:= True;
Break;
End;
End;
SetLength(ATPA,0);
SetLength(LogColours,0);
End;

DannyRS

2013-01-21 13:07:59

I think MMtoMS is broken atm?

Does it account for the 50 pixel navbar offset?

Runehack123

2013-01-21 13:39:25

@DannyRS thanks for fast reply!

No idea about MMtoMS being broken. I asked on IRC and Wizzup says that something makes him think that it's broken? Not sure what ''> Foo does not. This makes me have reason to think MMSToMS is broken. Is this the case?'' means, but Wizzup_ said that on IRC when I asked.

As for 50 navbar offset.. I'm getting points on the screen with MMtoMS and creating a TBox around them so I don't see how it would since I'm not using any fixed co-ordinates.

EDIT: 2 strange things..
1- Mouse moves to fire, which is not a red dot on MM and is 30 pixels (Minimum distance) away from the nearest log so well out of the range of my TBox.
2- When I moved my character to the middle between all those logs at one point the mouse just moved 20 pixels next to a log and the script stopped. Can't be because of colour because the walls floor are 100% grey and completely different from the colour! Even at 30 Tol - I checked on ACA! THere's no colour marked on any of the grey areas.

Olly

2013-01-21 13:56:42

MMtoMS is not that accurate at the moment because the camera angle etc has changed alot since Narcle made it, and he's not active to update it atm :P

Runehack123

2013-01-21 13:59:43

@Ollybest thanks I didn't realise it changed? A week ago when I was writing a banker finding function it was working PERFECTLY.

EDIT: Made some minor changes to my ATPA and the size of TBox. Still uses MMtoMS, but is working great now. Thanks for help @DannyRS, Olly.