SRL Archive - OSR Help

Avoid dropped ores?


RISK

2011-11-19 18:46:06

Is there a way to differentiate between dropped ores and rocks while using TPAs? Whenever there is an ore on the ground with similar colors to the rock you are mining, it will mouse over it and then mouse to the rock when it realizes the ore on the ground is not a rock.
This, needless to say, is very "bot-like" as a human would know that the ore on the ground is not what they are trying to interact with.

An image for example just in case.

Thank you in advance as any help would be very appreciated!

YoHoJo

2011-11-19 18:51:36

It might be possible to just get a good color that doesn't include both ores.
I have an iron color ACA that only finds rocks, if you let me onto that account really quick I can try and whip up a copper one.

Another way if first finding the rocks and turning them into TPA/ATPAs, and then using the TPABounds of the rocks as your search area.

So 1st search for rocks, then ONLY search within rock bounds for the ore color.

I have a pretty sweet procedure that does that for iron ores you can easily mod to do for those I bet let me know if you want me to post it so you can check it out.

RISK

2011-11-19 18:59:37

Yeah I'd really appreciate it if you could post it. I'd love to study it and learn how to do it too. I'm always happy to learn new things!

I sent you a PM with my account details.
Thanks in advance, I really appreciate the help!

From: YoHoJo
It might be possible to just get a good color that doesn't include both ores.
I have an iron color ACA that only finds rocks, if you let me onto that account really quick I can try and whip up a copper one.

Another way if first finding the rocks and turning them into TPA/ATPAs, and then using the TPABounds of the rocks as your search area.

So 1st search for rocks, then ONLY search within rock bounds for the ore color.

I have a pretty sweet procedure that does that for iron ores you can easily mod to do for those I bet let me know if you want me to post it so you can check it out.

KingKong

2011-11-19 19:03:31

From: YoHoJo
It might be possible to just get a good color that doesn't include both ores.
I have an iron color ACA that only finds rocks, if you let me onto that account really quick I can try and whip up a copper one.

Another way if first finding the rocks and turning them into TPA/ATPAs, and then using the TPABounds of the rocks as your search area.

So 1st search for rocks, then ONLY search within rock bounds for the ore color.

I have a pretty sweet procedure that does that for iron ores you can easily mod to do for those I bet let me know if you want me to post it so you can check it out.


^This. Make sure you get the right color and it shouldn't be a problem(Use ACA). Also use CTS2 for higher accuracy and try and tinker around with the sorting the atpa/tpa.

YoHoJo

2011-11-19 19:23:37

Will post in a second, have to dig for it.
On your account now trying to find and see if there are any good colors.

ACA File:
http://up.ht/vXfPYJ

Sample:
http://i.imgur.com/9pkQt.png

Still finds a few points on ores of course, but as you can see mostly rock points are found, so just have a minimum pixel check and you're all good.

The ACA file only has a small handful of colors so you will probably need to switch servers and stuff like that to get more colors than what I have and add onto the file.

Try picking the lighter colors on the rocks and avoid darker ones, click the show matching points button if if ever there are too many on ores delete the color and pick some others.

Good Luck.

Ok so this is messy as HELL and has a few procedure/functions that are within my script, but basically first it finds the colors of the actual ROCKS and breaks them into 35X35 boxes, then it searches within each of those boxes for the color of the ore.

The ACA I posted should be just fine, but if you want to use this too it would work if you edited it a bit.

It's EXTEMELY messy and stuff because I has no idea what I was doing and messing around a lot and stuff but if you have any questions just ask and I'll do my best to explain any lines.

Basally just up to:
BingoPt:= MiddleTPA(BingoBox[I]); 

Is all you will need to use. You might also want to uncomment the
{DebugTPA(OrePts,''); 
DebugTPA lines to see what is actually going on.


Function MineRock(WutRock:Integer):Boolean;
var I,PlusOne,tMine,J:Integer;
OrePts, RockPts:TPointArray;
RockPtsBox, BingoBox: T2DPointArray;
BingoPt: TPoint;
SearchBox: TBox;
Begin
If Not(LoggedIn) Then Exit;
StatsGuise('Searching For Rock: '+ IntToStr(InvCount));
If OreInLast Then Exit;

ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.02, 0.09);
FindColorsSpiralTolerance(MSCX, MSCY, RockPts, 3565690, MSX1, MSY1, MSX2, MSY2, 12);
SetColorSpeed2Modifiers(0.2,0.2);
ColorToleranceSpeed(1);

RockPtsBox:=TPAtoATPAEx(RockPts,35,35);
{DebugATPABounds(RockPtsBox);
Writeln('This is RockPtsBox');}


//Writeln('RockPts ' + IntToStr (GetArrayLength(RockPts) ) );

For I:=0 To High(RockPtsBox) Do
Begin
If Not(LoggedIn) Then Break;
//Writeln('Searching Box ' +IntToStr (i));
SearchBox:= GetTPABounds(RockPtsBox[i]);
//Writeln( IntToStr(SearchBox.x1) + ',' + IntToStr(SearchBox.y1)+ ',' + IntToStr(SearchBox.x2)+ ',' + IntToStr(SearchBox.y2) );
If (GetArrayLength(RockPtsBox[I]) > 30) Then
Begin
If YDebug Then DebugATPA(RockPtsBox,'');
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.07,1.06);
FindColorsSpiralTolerance(MSCX,MSCY,OrePts,3358822,SearchBox.x1,SearchBox.y1,SearchBox.x2,SearchBox.y2,6);
Writeln('OrePts ' + IntToStr (GetArrayLength(OrePts) ) );
SetColorSpeed2Modifiers(0.2,0.2);
ColorToleranceSpeed(1);
If High(OrePts) > 1 Then
Begin
BingoBox:=TPAtoATPAEx(OrePts, 1, 1);
{DebugTPA(OrePts,'');
Writeln('This is BingoBox'); }
If GetArrayLength(BingoBox[i])<1 Then Continue;
BingoPt:= MiddleTPA(BingoBox[I]);
If CheckAndClick('ine',BingoPt.x,BingoPt.y) Then
Begin
Result:=True;
MarkTime(tMine);
StatsGuise('Mining Rock: '+ IntToStr(InvCount));
Players[CurrentPlayer].Loc:='Mining';
PlusOne:=InvCount+1;
Repeat
If Not(LoggedIn) Then Break;
Wait(200);
If Random(2) = 0 Then
Begin
RT:=GetSystemTime;
If FindNormalRandoms Then
IncEx(WeMined,GetSystemTime - RT);
End;
If Random(50)=1 Then SleepAndMoveMouse(500+Random(100));
//If (Not(IsMoving)) Then Begin Writeln('a'); Break; End;
If InvCount=PlusOne Then
Begin
Inc(J);
TOres:=TOres + J;
Inc(Players[CurrentPlayer].Integers[81]);
End;
Until (InvCount = PlusOne) Or (TimeFromMark(tMine) > ((Players[CurrentPlayer].Integers[2]*1000) + Random(500)));
Exit;
End;
End Else Continue;
End;
Wait(750+Random(250));
End;
End;