SRL Archive - OSR Help

Please tell me what's wrong.


Yanhua

2011-12-17 03:14:32

Hey guys,

For the last few hours I've been trying to make an al-kharid dessert beer glass collector.

It collects beer glasses (Searches the shelves) then banks them at the al kharid bank, then repeats.

The problem is the banking part, I've tried multiple methods to locate the bank booth or the banker, I've tried DTM, colour…All don't seem to work well.

Also, when I start the my script it will right click at the top left hand corner of the RS screen and just sit there? It's a common bug that always happens. Quite annoying and I've been trying my hardest to fix it, but I can't seem to find a valid reason.

Anyways, here's my script so far. Please tell me what I can improve on and what a better method to locate bank is.


program GlassGrabber;

{$i SRL\SRL.scar}
{$i sps/sps.simba}

Var
Path:TPointArray;


Procedure DepositGlass;
Var
X, Y:Integer;
Begin
Begin
X:=215
Y:=160
MMouse(X, Y, 3, 3);
wait(RandomRange(200,100));
Mouse(X, Y, 0, 0, False);
ChooseOption('quickly');
wait(RandomRange(1000,700));
DepositAll;
wait(RandomRange(2000,1000));
CloseBank;
end;
end;

Function GetGlass:Boolean;
Var
A, B:Integer;
Begin
SetAngle(True);
FindObj(A, B, 'earch Shelv', 3164471 , 5);
wait(RandomRange(500,200));
MMouse(A, B, 5, 5);
wait(RandomRange(500,300));
Mouse(A, B, 0, 0, False);
ChooseOption('alk here');
wait(RandomRange(3000,2000));

if FindObj(A, B, 'earch Shelv', 3164471 , 5) Then
Begin
MMouse(A, B, 5, 5);
wait(RandomRange(200,90));
if IsUpText('earch Shelv') Then
Repeat
wait(RandomRange(2500,1600));
Mouse(A, B, 0, 0, True);
until(InvFull);
writeln('Inventory is full. Going to bank.')
end;
end;

Procedure ToBank;

Var
Path:TPointArray;
begin
SPS_Setup(RUNESCAPE_SURFACE, ['12_10', '12_9']);
Path := [Point(5089, 4084), Point(5040, 4069), Point(4980, 4058), Point(4941, 4027), Point(4921, 3996)];
writeln('Walking to the bank! :)');
SPS_WalkPath(Path);
wait(randomrange(1000,800));
End;

Procedure ToShelves;

Var
Path:TPointArray;
begin
SPS_SETUP(RUNESCAPE_SURFACE, ['12_10', '12_9']);
Path := [Point(4940, 4024), Point(4971, 4058), Point(5019, 4067), Point(5075, 4075), Point(5114, 4103)];
writeln('Walking back the the shelves to get more glass! :)');
SPS_WalkPath(Path);
wait(randomrange(1000,700));
end;
Procedure StepToBooth;
Var
X, Y, Tile:Integer;
begin
Tile := DTMFromString('mggAAAHicY2NgYFBlgAB2IBYBYj4g5gJiXyCeAMRZUHklIHYG4pkloQyP9k9neHVsNhj/urwMjJmAcsxYMCMODAEAL8sPOA==');
FindDTM(Tile, X, Y, MSX1, MSY1, MSX2, MSY2)
MMouse(X, Y, 2, 2);
Wait(500+random(500));
Mouse(X, Y, 3, 3, True);
Wait(1000+random(500));
FreeDTM(Tile);
end;




begin
SETUPSRL;
ClickNorth(True);
repeat
if not InvFull then
begin
wait(1000+random(500));
ToShelves;
wait(1000+Random(500));
Getglass;
end;
if InvFull Then
begin
wait(1000+random(500));
ToBank;
wait(1000+random(500));
StepToBooth;
Wait(1000+Random(500));
DepositGlass;
wait(1000+Random(500));
end;
until(false)


end.

Thanks guys :) Looking forward to comments.

YoHoJo

2011-12-17 03:17:53

Check out bank.scar in SRL, it has pre-made banking functions.
Also DTMS suck for the mainscreen most of the time, don't use them there!
Why not find bank same way you search shelves, with FindObj?

Yanhua

2011-12-17 03:21:13

From: YoHoJo
Check out bank.scar in SRL, it has pre-made banking functions.
Also DTMS suck for the mainscreen most of the time, don't use them there!
Why not find bank same way you search shelves, with FindObj?


Wow, Thanks for the fast reply!

Yeah, I've tried with FindObj, but the colours of the booth and the bankers are not unique and the surroundings usually interfere with it.

Any idea what is causing the top left screen right click bug? Been trying to figure that out for hours would be great if you could take a look :).

YoHoJo

2011-12-17 03:26:37

Didn't read that part just glaceed.
That happens normally if you forget a GetMousePos(X,Y) (or in your case A,B) but might be something else, try sprinkling some more of those in somewhere.

When does this normally happen again? Within which procedure do you think?

Yanhua

2011-12-17 03:28:31

From: YoHoJo
Didn't read that part just glaceed.
That happens normally if you forget a GetMousePos(X,Y) (or in your case A,B) but might be something else, try sprinkling some more of those in somewhere.

When does this normally happen again? Within which procedure do you think?


It's the first thing that happens when I start the script. I think it's after the script realises that inventory is full.

Anyways, checked out banking.scar, going to try out some of those now, they seem really cool :)

Yanhua

2011-12-17 03:39:19

Still not working.

The right clicking thing went away, but now it doesn't attempt to find a banker at all.

I'm using FindBank from banking.scar


program GlassGrabber;

{$i SRL\SRL.scar}
{$i sps/sps.simba}

Var
Path:TPointArray;


Procedure DepositGlass;
Begin
Begin
FindBank('akb');
wait(1000+Random(500));
DepositAll;
wait(RandomRange(2000,1000));
CloseBank;
end;
end;

Function GetGlass:Boolean;
Var
A, B:Integer;
Begin
SetAngle(True);
FindObj(A, B, 'earch Shelv', 3164471 , 5);
wait(RandomRange(500,200));
MMouse(A, B, 5, 5);
wait(RandomRange(500,300));
Mouse(A, B, 0, 0, False);
ChooseOption('alk here');
wait(RandomRange(3000,2000));

if FindObj(A, B, 'earch Shelv', 3164471 , 5) Then
Begin
MMouse(A, B, 5, 5);
wait(RandomRange(200,90));
if IsUpText('earch Shelv') Then
Repeat
wait(RandomRange(2500,1600));
Mouse(A, B, 0, 0, True);
until(InvFull);
writeln('Inventory is full. Going to bank.')
end;
end;

Procedure ToBank;

Var
Path:TPointArray;
begin
SPS_Setup(RUNESCAPE_SURFACE, ['12_10', '12_9']);
Path := [Point(5089, 4084), Point(5040, 4069), Point(4980, 4058), Point(4941, 4027), Point(4921, 3996)];
writeln('Walking to the bank! :)');
SPS_WalkPath(Path);
wait(randomrange(1000,800));
End;

Procedure ToShelves;

Var
Path:TPointArray;
begin
SPS_SETUP(RUNESCAPE_SURFACE, ['12_10', '12_9']);
Path := [Point(4940, 4024), Point(4971, 4058), Point(5019, 4067), Point(5075, 4075), Point(5114, 4103)];
writeln('Walking back the the shelves to get more glass! :)');
SPS_WalkPath(Path);
wait(randomrange(1000,700));
end;
//Procedure StepToBooth;
//Var
//X, Y, Tile:Integer;
//begin
//Tile := DTMFromString('mggAAAHicY2NgYFBlgAB2IBYBYj4g5gJiXyCeAMRZUHklIHYG4pkloQyP9k9neHVsNhj/urwMjJmAcsxYMCMODAEAL8sPOA==');
//FindDTM(Tile, X, Y, MSX1, MSY1, MSX2, MSY2)
//MMouse(X, Y, 2, 2);
//Wait(500+random(500));
//Mouse(X, Y, 3, 3, True);
//Wait(1000+random(500));
//FreeDTM(Tile);
//end;




begin
SETUPSRL;
ClickNorth(True);
repeat
if not InvFull then
begin
wait(1000+random(500));
ToShelves;
wait(1000+Random(500));
Getglass;
end;
if InvFull Then
begin
wait(1000+random(500));
ToBank;
wait(1000+random(500));
DepositGlass;
wait(1000+Random(500));
end;
until(false)


end.

Yanhua

2011-12-17 03:59:28

Wow, can't believe it! :D :D :) :)

I managed to fix the script! It's going flawless now!

Here it is if anyone is interested:


program GlassGrabber;

{$i SRL\SRL.scar}
{$i sps/sps.simba}

Var
Path:TPointArray;


Procedure DepositGlass;
Var
X, Y:Integer;
Begin
Begin
OpenBankFast('akb');
wait(RandomRange(1000,700));
DepositAll;
wait(RandomRange(2000,1000));
CloseBank;
end;
end;

Function GetGlass:Boolean;
Var
A, B:Integer;
Begin
SetAngle(True);
FindObj(A, B, 'earch Shelv', 3164471 , 5);
wait(RandomRange(500,200));
MMouse(A, B, 5, 5);
wait(RandomRange(500,300));
Mouse(A, B, 0, 0, False);
ChooseOption('alk here');
wait(RandomRange(3000,2000));

if FindObj(A, B, 'earch Shelv', 3164471 , 5) Then
Begin
MMouse(A, B, 5, 5);
wait(RandomRange(200,90));
if IsUpText('earch Shelv') Then
Repeat
wait(RandomRange(2500,1600));
Mouse(A, B, 0, 0, True);
until(InvFull);
writeln('Inventory is full. Going to bank.')
end;
end;

Procedure ToBank;

Var
Path:TPointArray;
begin
SPS_Setup(RUNESCAPE_SURFACE, ['12_10', '12_9']);
Path := [Point(5089, 4084), Point(5040, 4069), Point(4980, 4058), Point(4941, 4027), Point(4921, 3996)];
writeln('Walking to the bank! :)');
SPS_WalkPath(Path);
wait(randomrange(1000,800));
End;

Procedure ToShelves;

Var
Path:TPointArray;
begin
SPS_SETUP(RUNESCAPE_SURFACE, ['12_10', '12_9']);
Path := [Point(4929, 3995), Point(4945, 4043), Point(4997, 4067), Point(5056, 4092), Point(5111, 4106)];;
writeln('Walking back the the shelves to get more glass! :)');
SPS_WalkPath(Path);
wait(randomrange(1000,700));
end;
Procedure StepToBooth;
Var
X, Y, Tile:Integer;
begin
Tile := DTMFromString('mggAAAHicY2NgYFBlgAB2IBYBYj4g5gJiXyCeAMRZUHklIHYG4pkloQyP9k9neHVsNhj/urwMjJmAcsxYMCMODAEAL8sPOA==');
FindDTM(Tile, X, Y, MSX1, MSY1, MSX2, MSY2)
MMouse(X, Y, 2, 2);
Wait(500+random(500));
Mouse(X, Y, 3, 3, True);
Wait(1000+random(500));
FreeDTM(Tile);
end;




begin
SETUPSRL;
ClickNorth(True);
repeat
if not InvFull then
begin
wait(1000+random(500));
ToShelves;
wait(1000+Random(500));
Getglass;
end;
if InvFull Then
begin
wait(1000+random(500));
ToBank;
wait(1000+random(500));
StepToBooth;
Wait(1000+Random(500));
DepositGlass;
wait(1000+Random(500));
end;
until(false)


end.