Log in

View Full Version : Better object finding?



Syntax
05-30-2012, 02:45 AM
Hi guys, I'm making a powerminer as my first script and just wondering what is the best way to find an object currently using colour but its not very accurate.

kevin33
05-30-2012, 02:48 AM
If I understand what your asking correctly then I would suggest trying to use ACA (Auto Colour Aid). Easy to use and quite accurate.

YoHoJo
05-30-2012, 02:56 AM
ACA,TPA, ATPAs.
I've made a video tutorial about how to use ACA to find items pretty well.
YoHoJoSRL is my YouTube channel name.

You can look in tutorial island section to learn TPA/ATPAs they are super awesome.


These two use together are very powerful and what most of the best scripts use to find objects.

Runaway
05-30-2012, 02:58 AM
Try out the TPA functions in my signature, they work really well for rock-finding :)

(TPointCluster is a little better for mining imo)

Syntax
05-30-2012, 03:25 AM
Ok I tried including it Yohojo instead of my previous procedure here is the code:

program Iron_Miner;
{$DEFINE SMART}
{$i srl/srl.simba}
{.include SRL\SRL.simba}

const
SRLStats_User = ''; // Your SRL Stats Username
SRLStats_Password = ''; // Your SRL Stats Password
SERVER = 35; // Enter "0" to pick a random server.
MEMBERS = True;
Version ='1.1';


Procedure DeclarePlayers;
begin;
HowManyPlayers:=1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer:=0;

Players[0].Name:='blake';
Players[0].Pass:='';
Players[0].Nick:='';
Players[0].Active:=True;
end;

procedure AntiBan;
begin
if(not(LoggedIn))then
Exit;
FindNormalRandoms;
case Random(160) of
0:
begin
WriteLn('AntiBan Is Being Performed');
GameTab(Tab_Stats);
HoverSkill('Mining', false);
wait(2500 + Random(1000));
Mouse(659, 189, 0, 0, True);
end;
1:
begin
WriteLn('Bored')
BoredHuman;
end;
end;
end;

Procedure MineOre;
var x, y, PlusOne, MineCounter : integer;
begin
{if not FindNormalRandoms then
if not LoggedIn then
TerminateScript};
MakeCompass('N');
SetAngle(SRL_ANGLE_HIGH);
wait(200+random(400));
function FindObject(var x, y: Integer): Boolean;
var
arP, arAP: TPointArray;
arC, arUC: TIntegerArray;
ararP: T2DPointArray;
tmpCTS, i, j, arL, arL2: Integer;
P: TPoint;
X, Y, Z: Extended;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.03, 0.52);

if not(FindColorsTolerance(arP, 2436940, MSX1, MSY1, MSX2, MSY2, 12)) then
begin
Writeln('Failed to find the color, no object found.');
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Exit;
end;

arC := GetColors(arP);
arUC := arC;
ClearSameIntegers(arUC);
arL := High(arUC);
arL2 := High(arC);

for i := 0 to arL do
begin
ColorToXYZ(arC[i], X, Y, Z);

if (X >= 1.17) and (X <= 10.58) and (Y >= 1.01) and (Y <= 8.64) and (Z >= 0.65) and (Z <= 4.38) then
begin
for j := 0 to arL2 do
begin
if (arUC[i] = arC[j]) then
begin
SetLength(arAP, Length(arAP) + 1);
arAP[High(arAP)] := arP[j];
end;
end;
end;
end;

SortTPAFrom(arAP, Point(MSCX, MSCY));
ararP := SplitTPAEx(arAP, 10, 10);
arL := High(ararP);

for i := 0 to arL do
begin
if (Length(ararP[i]) < 10) then Continue;
P := MiddleTPA(ararP[i]);
MMouse(P.x, P.y, 5, 5);
Wait(100 + Random(100));
if (IsUpText('Take')) then
begin;
Result := True;
Break;
end;
end;

ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);

if (i = arL + 1) then
begin
Writeln('FindObject could not find object.');
Exit;
end;

GetMousePos(x, y);
end;


case random(2) of
0: Mouse(x, y, 5, 5, True);
1: begin
Mouse(x, y, 5, 5, False);
WaitOption('Mine', 500);
if (invfull) then DropAll
end;
end;

repeat
MarkTime(MineCounter);
Antiban;
Wait(100);
if InvCount=Plusone Then
writeln('We Mined an ore');
Until (InvCount=PlusOne) or (TimeFromMark (MineCounter) > 6500)
end;
end;
end;



begin
Smart_Signed := TRUE;
Smart_Members := MEMBERS;
Smart_SuperDetail := FALSE;
Smart_Server := 35;
ActivateClient;
SetUpSRL;
DeclarePlayers;
LoginPlayer;
wait(4000+random(400));
repeat
MineOre;
Antiban;
Until(false);

end.


Can't seem to get it to compile though, thanks again.

Brandon
05-30-2012, 03:36 AM
Problems with your code.. You included SRL/SRL.Simba TWICE.

Not only that, you have a function declared within another function. You cannot do that in Simba.

Syntax
05-30-2012, 05:41 AM
Problems with your code.. You included SRL/SRL.Simba TWICE.

Not only that, you have a function declared within another function. You cannot do that in Simba.

Fixed, any suggestions for finding ores better?

YoHoJo
05-30-2012, 05:43 AM
Checkout my PMS power miner script.
Uses ACA, TPA, ATPA.
Might need to read some tuts to understand it all if you're new, but it's nothing too crazy and works very well.

Syntax
05-30-2012, 07:12 AM
Checkout my PMS power miner script.
Uses ACA, TPA, ATPA.
Might need to read some tuts to understand it all if you're new, but it's nothing too crazy and works very well.
Nice job, tutorials on TPA and ATPA aren't so great, checked out your youtube channel couldn't find any videos on them unfortunately :S

P1ng
05-30-2012, 07:44 AM
You can't put the ACA color finding function in the middle of your MineOre procedure. You will need to separate them out with MineOre called after FindObject so that the script already knows what FindObject is when you call upon it.

Procedure MineOre;
var x, y, PlusOne, MineCounter : integer;
begin
{if not FindNormalRandoms then
if not LoggedIn then
TerminateScript};
MakeCompass('N');
SetAngle(SRL_ANGLE_HIGH);
wait(200+random(400));
if FindObject(x,y) then //call this instead of the ACA function
case random(2) of //it will call upon the function itself and
0: Mouse(x, y, 5, 5, True);//if it returns true continue on else it will exit
1: begin
Mouse(x, y, 5, 5, False);
WaitOption('Mine', 500);
if (invfull) then DropAll
end;
end else
Exit;
end;

Place that code after the "FindObject" function that ACA gave you and that should work. This is simply the code you already had without a function in the middle of it. It compiles anyway, so see how you go

Syntax
05-30-2012, 08:32 AM
You can't put the ACA color finding function in the middle of your MineOre procedure. You will need to separate them out with MineOre called after FindObject so that the script already knows what FindObject is when you call upon it.

Procedure MineOre;
var x, y, PlusOne, MineCounter : integer;
begin
{if not FindNormalRandoms then
if not LoggedIn then
TerminateScript};
MakeCompass('N');
SetAngle(SRL_ANGLE_HIGH);
wait(200+random(400));
if FindObject(x,y) then //call this instead of the ACA function
case random(2) of //it will call upon the function itself and
0: Mouse(x, y, 5, 5, True);//if it returns true continue on else it will exit
1: begin
Mouse(x, y, 5, 5, False);
WaitOption('Mine', 500);
if (invfull) then DropAll
end;
end else
Exit;
end;

Place that code after the "FindObject" function that ACA gave you and that should work. This is simply the code you already had without a function in the middle of it. It compiles anyway, so see how you go
Does the same thing, thanks for the reply though.

P1ng
05-30-2012, 12:25 PM
What is the same thing that it is doing?

Also try removing the line {.include SRL\SRL.simba}
and if you are still getting errors with the compiling what are they?

Syntax
05-30-2012, 12:45 PM
What is the same thing that it is doing?

Also try removing the line {.include SRL\SRL.simba}
and if you are still getting errors with the compiling what are they?

...You need the include I have been told and removing it has given me another error. Thanks for helping though.

P1ng
05-30-2012, 01:48 PM
program Iron_Miner; // Name of script.
{$DEFINE SMART} // Include SMART.
{$i srl/srl.simba} // Include SRL
{.include SRL\SRL.simba} //Include SRL

You have SRL included twice, hence the duplicate identifier issue, this new error you are getting has to do with something else in your script. If you post what the new error is as it crops up someone can help you fix it. If you just say there's another error then if someone helps you they just have to sit there and go through your whole script re-compiling with every change until all the errors are gone and each procedure runs smoothly.

EDIT: Went through the script because I'm bored and can't sleep.

To fix your scripts current compiling errors:
1. Remove the second, SRL include.
2. Remove the ACA function called within "MineOre" procedure.
3. Re-do the ACA function inputting the correct UpText and copy/pasting straight from the program into the script.
4. Call if FindObject(x,y) then in your "MineOre" procedure.

These 4 steps will remove all current compiling errors, whether or not the script actually works, is another matter.

Syntax
05-30-2012, 11:00 PM
Thanks p1ng i got it to compile, although as you mentioned the script doesn't work. Heres the code, and thanks i appreciate the help



program FindObject;
{$DEFINE SMART}
{.include SRL\SRL.simba}


const
SRLStats_User = ''; // Your SRL Stats Username
SRLStats_Password = ''; // Your SRL Stats Password
SERVER = 35; // Enter "0" to pick a random server.
MEMBERS = True;
Version ='1.4';

Procedure DeclarePlayers;
begin;
HowManyPlayers:=1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer:=0;

Players[0].Name:='';
Players[0].Pass:='';
Players[0].Nick:='';
Players[0].Active:=True;
end;
procedure AntiBan;
begin
if(not(LoggedIn))then
Exit;
FindNormalRandoms;
case Random(160) of
0:
begin
WriteLn('AntiBan Is Being Performed');
GameTab(Tab_Stats);
HoverSkill('Mining', false);
wait(2500 + Random(1000));
Mouse(659, 189, 0, 0, True);
end;
1:
begin
WriteLn('Bored')
BoredHuman;
end;
end;
end;

var
x, y: Integer;

function FindObject(var fx, fy: Integer): Boolean;
var
arP, arAP: TPointArray;
arC, arUC: TIntegerArray;
ararP: T2DPointArray;
tmpCTS, i, j, arL, arL2: Integer;
P: TPoint;
X, Y, Z: Extended;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.03, 0.52);

if not(FindColorsTolerance(arP, 2436940, MSX1, MSY1, MSX2, MSY2, 12)) then
begin
Writeln('Failed to find the color, no object found.');
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Exit;
end;

arC := GetColors(arP);
arUC := arC;
ClearSameIntegers(arUC);
arL := High(arUC);
arL2 := High(arC);

for i := 0 to arL do
begin
ColorToXYZ(arC[i], X, Y, Z);

if (X >= 1.17) and (X <= 10.58) and (Y >= 1.01) and (Y <= 8.64) and (Z >= 0.65) and (Z <= 4.38) then
begin
for j := 0 to arL2 do
begin
if (arUC[i] = arC[j]) then
begin
SetLength(arAP, Length(arAP) + 1);
arAP[High(arAP)] := arP[j];
end;
end;
end;
end;

SortTPAFrom(arAP, Point(MSCX, MSCY));
ararP := SplitTPAEx(arAP, 10, 10);
arL := High(ararP);

for i := 0 to arL do
begin
if (Length(ararP[i]) < 10) then Continue;
P := MiddleTPA(ararP[i]);
MMouse(P.x, P.y, 5, 5);
Wait(100 + Random(100));
if (IsUpText('ine')) then
begin;
Result := True;
Break;
end;
end;

ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);

if (i = arL + 1) then
begin
Writeln('FindObject could not find object.');
Exit;
end;

GetMousePos(fx, fy);
end;
Procedure MineOre;
var x, y, PlusOne, MineCounter : integer;
begin
{if not FindNormalRandoms then
if not LoggedIn then
TerminateScript};
MakeCompass('N');
SetAngle(SRL_ANGLE_HIGH);
wait(200+random(400));

case random(2) of
0: Mouse(x, y, 5, 5, True);
1: begin
Mouse(x, y, 5, 5, False);
WaitOption('Mine', 500);
if (invfull) then DropAll
end;
end;
repeat
MarkTime(MineCounter);
Antiban;
Wait(100);
if InvCount=Plusone Then
writeln('We Mined an ore');
Until (InvCount=PlusOne) or (TimeFromMark (MineCounter) > 6500)
end;
begin
Smart_Signed := TRUE;
Smart_Members := MEMBERS;
Smart_SuperDetail := FALSE;
Smart_Server := 35;
ActivateClient;
SetupSRL;
DeclarePlayers;
LoginPlayer;
wait(4000+random(400));
repeat
MineOre;
Antiban;
FindObject(x, y);
until(false)
end.

P1ng
05-30-2012, 11:06 PM
Not a problem, glad my inability to sleep could help you out :)
Best of luck with getting it to work now