SRL Archive - OSR Help

help mining iron


westkevin12

2013-04-28 20:36:26

I've tried a few ways of clicking the iron ore but i'm not experienced so all the ways i have tried have failed.
tried using aca and couldn't get the function it gave me into my script without errors.
I made a bitmap image of the iron ore and tried to get it to find the bitmap but it couldn't find it or wouldn't click it not sure wich one.
tried just using DTM of the iron and it won't click that either.
so atm i'm just stuck with a half finished script that walks from yanil bank to the iron pit and sits there not mining.
any suggestions?


 program westkevin12yanilironminer;
{$DEFINE SMART8}
{$i srl-osr/srl.simba}



var
x,y: integer;
inbank:integer;
Gate:integer;
betweentrees:integer;
nearpit:integer;
inpit:integer;
BUGate:integer;
BUbetweentrees:integer;
BUnearpit:integer;
BUinpit:integer;
ironSpot:integer;
ironore:integer;





Procedure LoadDTM;
Begin
inbank := DTMFromString('mbQAAAHicY2VgYDjLwsCwGYgnAfFbIL4BxAVA8RAgzgbicCDuBeL5U6YwFAQaw7F7tgUDF1AcHTNiwWAAAGJVC8g=');
Gate := DTMFromString('mbQAAAHicY2VgYBBjYWCQB2IBIJYDYi4gXgcUXw7EO4B4OxAvBuLKwgKGd+/egTGIHTZFiUEEKI6OGbFgMAAAW54Nqw==');
BUGate := DTMFromString('mggAAAHicY2NgYKhjYWDoAuIqIG4D4lYgzgPiYqBcHhDXA3ENEMcBcS4Qx4YGMwSbyTK8e/cOzBYyY2MwrBBi4ALKYcOMODAEAAAlngyG');
betweentrees := DTMFromString('mggAAAHicY2NgYMhgYWCIAeIyII4D4hYgzgLiVKBcOhAXQHEsEIcDceIUJQYhMzY4fv/yOUPmBCUGEaAcNsyIA0MAAJz8C14=');
BUbetweentrees := DTMFromString('mbQAAAHicY2VgYChiYWBIBeIaIE4A4k4gzgCKpwFxHhCXAnE8EFtXCDEImbHB8afnXxi4gOLomBELBgMAc9oJGQ==');
nearpit := DTMFromString('mggAAAHicY2NgYEhnYWDIB+JYIE4E4gwgLgPiKKBcKBAnA3EwEBcCcRYQV01QYtBSt2AomQKhhczYwFgEKIcNM+LAEAAAJakJUw==');
BUnearpit := DTMFromString('mbQAAAHicY2VgYChhYWAoAuIKIM4C4mYgjgeKhwBxDhAXQtkhJUIMLo7+DEJmbAy6LsIMsUA+F1AcHTNiwWAAAECOB+M=');
inpit := DTMFromString('mggAAAHicY2NgYGhmgeA6IO4A4l4grgDiTKBcDRCnAXEKEOcBcQEQt/cqMaiIMTC4OPqDcT2Q3zJFiUEEKIcNM+LAEAAA3f0Luw==');
BUinpit := DTMFromString('mbQAAAHicY2VgYKhnYWAoA+JJQFwDxA1AnAsUzwDifJA8EKeC6F4lBhdHfzBWEWMA01xAcXTMiAWDAQCKogjg');
ironSpot := DTMFromString('mggAAAHicY2NgYPAGYmUgrgHiSUC8F4izgPgyEE8F4jYg3gPEaowMDE5AnBInwbC6x4+ht6mJIchThMHHVYnB31OFgRWoBhtmxIEhAAD3/Avw');
ironore := DTMFromString('mlwAAAHicY2dgYJBhZmAQB2IxZghbCYj1gVgTiH8B5RkZGRi+AOmPQMwGZDMzQtg+ekoMHjryDBoSggyWSlJgdoCBCoOzhiyDCFAeF2bEg6EAAGMdCSA=');

end;
procedure FreeAllDTMs;
begin
FreeDtm(inbank);
FreeDtm(Gate);
FreeDtm(BUGate);
FreeDtm(betweentrees);
FreeDtm(BUbetweentrees);
FreeDtm(nearpit);
FreeDtm(BUnearpit);
FreeDtm(inpit);
FreeDtm(BUinpit);
FreeDtm(ironSpot);
FreeDtm(ironore);
writeln('All DTMs have been freed.');
end;
procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
Players[0].Name := '';
Players[0].Pass := '';
Players[0].Active := True;
end;

procedure OpenMyBank;
var
x,y, attempts: Integer;

begin
MakeCompass('E');
setAngle(0);
repeat
Inc(attempts) //thankyou The Mayor for adding this 10 attempts
if FindColorTolerance(x, y, 7112083, 200, 62, 519, 174, 10)then
begin
MMouse(x, y, 5, 5);
wait(100);
if (IsUpTextMultiCustom(['bank booth'])) then
clickMouse2(MOUSE_left);

clickMouse2(MOUSE_left);
wait(1200);
end;
until (BankScreen) or (PinScreen) or (attempts > 10);

if (Attempts > 10) then
WriteLn('We failed to find the banker after 10 attempts')
end;
procedure DepositOre;

begin
if BankScreen then
Deposit(2,28,true);
wait(300);
CloseBank;
end;
procedure WalkToGate;
var
aFound: Extended; attempts: Integer;
begin
repeat
Inc(attempts)
if
FindDTMRotatedAlternating(gate, x, y, 560, 12, 720, 156, -35, 35, 1, aFound)
or
FindDTMRotatedAlternating(BUgate, x, y, 560, 12, 720, 156, -35, 35, 1, aFound)
then
begin
writeln('walking to the pit')
mmouse(x,y,2,2);
wait(300);
clickmouse2(MOUSE_LEFT);
end;
until
FlagPresent or (attempts > 20);
wait(500);
while (isMoving) do
wait(100);
writeln('25% there')
end;
procedure WalkToTrees;
var
aFound: Extended; attempts: Integer;
begin
repeat
Inc(attempts)
if
FindDTMRotatedAlternating(betweentrees, x, y, MMx1, MMy1, MMx2, MMy2, -15, 15, 2, aFound)
or
FindDTMRotatedAlternating(BUbetweentrees, x, y, 560, 12, 720, 156, -15, 15, 2, aFound)
then
begin
mmouse(x,y,2,2);
wait(300);
clickmouse2(MOUSE_LEFT);
end;
until
FlagPresent or (attempts > 20);
wait(500);
while (isMoving) do
wait(100);
writeln('50% there')
end;
procedure WalkNearPit;
var
aFound: Extended; attempts: Integer;
begin
repeat
Inc(attempts)
if
FindDTMRotatedAlternating(nearpit, x, y, MMx1, MMy1, MMx2, MMy2, -15, 15, 2, aFound)
or
FindDTMRotatedAlternating(BUnearpit, x, y, 560, 12, 720, 156, -15, 15, 2, aFound)
then
begin
mmouse(x,y,2,2);
wait(300);
clickmouse2(MOUSE_LEFT);
end;
until
FlagPresent or (attempts > 20);
wait(500);
while (isMoving) do
wait(100);
writeln('75% there')
end;
procedure WalkInPit;
var
aFound: Extended; attempts: Integer;
begin
repeat
Inc(attempts)
if
FindDTMRotatedAlternating(inpit, x, y, 560, 12, 720, 156, -35, 35, 1, aFound)
or
FindDTMRotatedAlternating(BUinpit, x, y, 560, 12, 720, 156, -35, 35, 1, aFound)
then
begin
mmouse(x,y,2,2);
wait(300);
clickmouse2(MOUSE_LEFT);

end;
until
FlagPresent or (attempts > 20);
wait(500);
while (isMoving) do
wait(100);
writeln('100% there')
end;
procedure WalkToPit;
begin
WalkToGate;
wait(100);
WalkToTrees;
wait(50);
WalkNearPit;
wait(75);
WalkInPit;
wait(120);
end;


procedure GetIronSpot;
var
aFound: Extended;
begin
if
FindDTMRotatedAlternating(ironSpot, x, y, 560, 12, 720, 156, -15, 15, 2, aFound)
then
begin
mmouse(x,y,0,0);
clickmouse2(MOUSE_LEFT);
wait(2500);
end;
end;

procedure findiron;
var
aFound: Extended;
X,y:integer;
begin

FindDTMRotatedAlternating(ironore, x, y, 560, 12, 720, 156, -30, 30, 2, aFound);

Mmouse(x,y,3,3);
ClickMouse2(Mouse_Left);

end;
procedure mineloop;
var
X,y:integer;
begin
repeat
findiron;
wait(1200);
until invfull;
end;

begin

SetupSRL;
LoadDTM;
Addonterminate('FreeAllDTMs');
DeclarePlayers;
If Not LoggedIn Then
LoginPlayer;
wait(5000);
OpenMyBank;
wait(2000);
DepositOre;
WalkToPit;
GetIronSpot;
mineloop;
end.


randy marsh

2013-04-28 21:17:14

I use this with dtms and works quite well tested on dropping logs :)



Program DTM;
{.include SRL/SRL.simba}
Var
Yewlog:integer; //The Name of the DTM
X,y:integer; // The X and the Y to store the cords for the DTM.

Procedure LoadDTM;
Begin
Yewlog := DTMFromString('78DA636C6462609064644006C1F65C601A26C' +
'A580954A382AA06260B57D30354234F404D17508D2001350D4035' +
'FC04D49411A1A600A84602BF1A00FCF004DF');
end;

Procedure FindItem;
Begin
if FindDTM(Yewlog, x, y, MIX1, MIY1, MIX2, MIY2) then // MI is the cords of the Invent
begin
MMouse(x,y,5,5); // Hovers over log
If Isuptext('Yew Log')then // If text up yew log it will click it
begin
mouse(x,y,5,5,true);
end else
Writeln('No DTM found'); // If cant find DTM it will say this.
end;
end;

Begin
SetupSRL; // MAIN LOOP
ActivateClient;
LoadDTM; // CALL the loading first
FindItem;
end.

westkevin12

2013-04-28 21:23:19

testing it in this way now, thanks

randy marsh

2013-04-29 19:30:47

Any luck?