SRL Archive - Help

Burying all bones in inventory when it's full


TsterT

2011-12-22 17:33:19

At the moment, I have this:


Function Bury: Boolean;
Var
BoneDTM, x, y : Integer;
begin
BoneDTM := DTMFromString('78DA635CCEC2C0B08F890119CC9838114C334' +
'2F98C0B806AF6A0AAD9BE613DAA9AB540353B51D5549596A2AA590F5' +
'4730855CD9AA54B50D52C06AA398EAAA6AEB212450D00F10D0FC4');

If (Not LoggedIn) Then Exit;
If Not Players[currentplayer].Active Then Exit;
if InvFull then
//if FindColorSpiralTolerance(x, y, boneDropColor, MIX1, MIY1, MIX2, MIY2, 15) then
repeat
if FindDTM(BoneDTM, x, y, MSX1, MSY1, MSX2, MSY2) then
begin
MMouse(x, y, 0, 0);
if(isUpText(bones)) then
begin
wait(200 + random(100));
Mouse(x, y, 0, 0, true);
end;
end;
until not(FindDTM(BoneDTM, x, y, MSX1, MSY1, MSX2, MSY2));
begin;
FreeDTM(BoneDTM);
buryCount := buryCount + 1;
xpGained := xpGained + 5;
end;
end;

And my loop is:

begin
SetUpSrl;
startUp;
ClearDebug;
ActivateClient;
Wait(1000 + Random(500));
repeat
bury;
pickUp;
until(false);
end.

Yet it doesn't bury the bones, and if it does, it only does 1, then continues back to picking up.

jakeyboy29

2011-12-22 17:40:58

procedure bury;
Begin
If Not LoggedIn Then Exit;
Begin
GameTab(4);
BonesInventory := DTMFromString('78DA631460606000612470FEDC1930CD08E53' +
'30A03090E54356C5049B81A6620C18BAA8685014D0D485E12558D' +
'201713AA1A6920218CDF1C00CA37033F');
Repeat
antirandom;
Status('Looking For Bones...');
If FindDTM(BonesInventory, X, Y, MIX1, MIY1, MIX2, MIY2) Then
MMouse(X, Y, 5, 5);
Wait(300+Random(100));
If (IsUpText('ones')) Then
Begin
Mouse(X, Y, 5, 5, True);
Inc(BonesBuried);
Status('Burying Bones...');
Wait(170+Random(50));
End;
Until (Not FindDTM(BonesInventory, X, Y, MIX1, MIY1, MIX2, MIY2))Or(Not LoggedIn);
FreeDTM(BonesInventory);
End;
End;

my old one from scar, might not work, 99% sure dtm will have to be changed

YoHoJo

2011-12-22 17:53:41

@Tster

It's becaues you have
until not(FindDTM(BoneDTM, x, y, MSX1, MSY1, MSX2, MSY2));

The box is wrong! It's searching mainscreen! :p
Change to
until not(FindDTM(BoneDTM, x, y, MIX1, MIY1, MIX2, MIY2));

and there you go!

TsterT

2011-12-22 18:35:30

Alright, fixed all that I needed to fix. It seems to just be an incorrect DTM. I added in some debugging stuff, it responds saying it couldn't find any bones to bury.

So once I get a correct DTM, that'll be it. Thanks for the little correction YoHoJo :P.

edit: Alright, so now it just seems like it's finding the DTM, but it isn't doing anything about it.

My code now:

Function Bury: Boolean;
Var
BoneDTM, x, y : Integer;
begin
BoneDTM := DTMFromString('78DA63FCC2C2C0F096910119ECDDBA9581154' +
'8C34419416A9EA2AA3975F020AA9A3F40350F51D51CD8B103550D339' +
'0F70A55CDEA254B50D40000D5640F4C');


If (Not LoggedIn) Then Exit;
If Not Players[currentplayer].Active Then Exit;
//if FindColorSpiralTolerance(x, y, boneDropColor, MIX1, MIY1, MIX2, MIY2, 15) then
Writeln('Looking for bones to bury');
repeat
if FindDTM(BoneDTM, x, y, MIX1, MIY1, MIX2, MIY2) then
MMouse(x, y, 0, 0);
if(isUpText(bones)) then
begin
wait(200 + random(100));
Mouse(x, y, 0, 0, true);
Status('Bone burried');
Inc(buryCount);
xpGained := xpGained + 5;
end;
wait(500 + random(100));
until not(FindDTM(BoneDTM, x, y, MIX1, MIY1, MIX2, MIY2));
If not(FindDTM(BoneDTM, x, y, MIX1, MIY1, MIX2, MIY2)) then
begin
Status('Couldn''t find bones');
end;
FreeDTM(BoneDTM);
end;

Loop

begin
SetUpSrl;
startUp;
ClearDebug;
ActivateClient;
Wait(1000 + Random(500));
repeat
if InvFull then
begin
bury;
end else
pickUp;
until(false);
end.

And my log comes up saying:

Looking for bones to bury
Looking for bones to bury
Looking for bones to bury
ect...

jakeyboy29

2011-12-22 18:58:11

 if(isUpText(bones)) then        Is the B on bones meant to be capital?
begin
wait(200 + random(100));
Mouse(x, y, 0, 0, true);
MMouse

I could be missing something god dam obvious, yoho?

TsterT

2011-12-22 19:09:48

From: jakeyboy29
 Is the B on bones meant to be capital?

No, it isn't.

MMouse is to move the mouse, Mouse is to actually click it. Or at least that's what I'm lead to believe.

jakeyboy29

2011-12-22 19:28:24

the MMouse wasnt meant to be there, i started writing a function for you.

procedure Bury;
var
Slots: TIntegerArray;
i: integer;
begin
if not LoggedIn then Exit;
Slots := [1, 2, 3, 4, 8, 7, 6, 5, 9, 10, 11, 12, 16, 15, 14, 13, 17, 18, 19,
20, 24, 23, 22, 21, 25, 26, 27, 28];
for i := 0 to 27 do
begin
if not ExistsItem(Slots[i]) then Continue;
MouseItem(Slots[i], True);
Inc(Players[CurrentPlayer].Integers[0]);
Wait(450 + random(80));
FindNormalRandoms;
end;
end;
http://villavu.com/forum/showthread.php?t=57330

TsterT

2011-12-22 21:23:43

From: jakeyboy29
the MMouse wasnt meant to be there, i started writing a function for you.

procedure Bury;
var
Slots: TIntegerArray;
i: integer;
begin
if not LoggedIn then Exit;
Slots := [1, 2, 3, 4, 8, 7, 6, 5, 9, 10, 11, 12, 16, 15, 14, 13, 17, 18, 19,
20, 24, 23, 22, 21, 25, 26, 27, 28];
for i := 0 to 27 do
begin
if not ExistsItem(Slots[i]) then Continue;
MouseItem(Slots[i], True);
Inc(Players[CurrentPlayer].Integers[0]);
Wait(450 + random(80));
FindNormalRandoms;
end;
end;
http://villavu.com/forum/showthread.php?t=57330


This works perfectly. So pretty much it checks whether or not an item is in the inventory slot, and if it is, it clicks it. How can you be sure it's always going to be bones?