SRL Archive - Help and Support

Picking up Bones and Coins.


WT-Fakawi

2011-03-04 07:48:49

This is my old and still current FindBones algo. It is simply based on the four corners of the bone sticking out on the runescape floor. Four small bitmaps. Now while this has worked for me for four years (and it still does) The big advantage of this function is that regardsless of what is covering the bone (rune, chicken, arrow, etc), it still finds the bone. But my algo also likes aprons, chef's hats and ashes…. I would really like to avoid that. Anyone with a better idea?


Function FindBones(Mode:Integer):Boolean;
var Dx, Dy, Ox, Oy, i, j, x1, x2, y1, y2, thebone, bone1, bone2, bone3, bone4:integer;
var acc:Extended;
Objects:Array of String;

begin
if InvFull then Begin Result := False; Exit; End;
case Mode of
1: Objects := ['Water rune', 'Beer', 'ake Coins','ake Bones']; // Minimal
2: Objects := ['taff of air', 'Sling', 'Water rune', 'Beer', 'chick', // Normal
'ake Raw','ake Coins','ake Bones'];
3: Objects := ['Water rune', 'Earth rune','Body rune', 'Mind rune', // Runes
'ake Coins','ake Bones'];
4: Objects := ['bolts','arrow','Beer','Air rune', 'Earth rune','Body rune', // All junk
'Water rune','Mind rune', 'ake Sling', 'ake Staff of air',
'ake Raw','ake Coins','ake Bones'];
end;

Bone1 := BitmapFromString(4, 1, 'B6ACABD3CDCDD3CDCDD3CDC' +
'D');
Bone2 := BitmapFromString(1, 5, 'E8E5E5B2A6A6B6ACABBBB0B' +
'0BEB5B5');
Bone3 := BitmapFromString(1, 7, 'D3CDCDBBB2B247381847381' +
'8473818B0A4A4B8ADAC');
Bone4 := BitmapFromString(5, 1, 'CDC6C6D3CDCD493E20DFDAD' +
'ADFDADA');
if InvFull then CleanUpInventory;
for j := 1 to 6 do
begin
case j of
1: begin x1:= MSx1; y1 := MSy1 + 20; x2 := MSCx; y2:= MSCy; end;
2: begin x1:= MSCx; y1 := MSy1 + 20; x2 := MSx2; y2:= MSCy; end;
3: begin x1:= MSx1; y1 := MSCy; x2 := MSCx; y2:= MSy2; end;
4: begin x1:= MSCx; y1 := MSCy; x2 := MSx2; y2:= MSy2; end;
5: begin x1:= MSCx - 50; y1 := MSCy - 50; x2 := MSCx + 50; y2:= MSCy + 50; end;
6: begin x1:= MSx1; y1 := MSy1 + 20; x2 := MSx2; y2:= MSy2; end;
end
for i := 1 to 3 do
begin
case i of
0: TheBone := Bone1;
1: TheBone := Bone2;
2: TheBone := Bone3;
3: TheBone := Bone4;
end;
if InvFull then
begin
freebitmap(Bone1);
freebitmap(Bone2);
freebitmap(Bone3);
freebitmap(Bone4);
Exit; // SetBitmapName(
end;
if (not Loggedin) then
begin
freebitmap(Bone1);
freebitmap(Bone2);
freebitmap(Bone3);
freebitmap(Bone4);
Exit;
end;
if FindDeformedBitmapToleranceIn(TheBone, Dx, Dy, x1, y1, x2 , y2 , 10, 1, True, acc) then
begin
if (acc > 0.9) then
begin
MMouse(Dx, Dy, 0, 6);
GetMousePos(Dx, Dy);
if pos('apron', GetUpText)<> 0 then
begin
Callibrate('C');
Exit;
end;
FTWait(1);
Mouse(Dx, Dy, 0, 0, False);
if ChooseOptionMulti(Objects) then
begin
FlagCal;
FTWait(4);
if pos ('reach that', GetblackchatMessage) <> 0 then // stuck somewhere.
begin
Callibrate('C');
Result := False;
freebitmap(Bone1);
freebitmap(Bone2);
freebitmap(Bone3);
freebitmap(Bone4);
Exit;
end;
Result := True;
Inc(Bones);
MisClickBreak := 0;
freebitmap(Bone1);
freebitmap(Bone2);
freebitmap(Bone3);
freebitmap(Bone4);
Exit;
end
else
begin
Inc(MisClickBreak);
if MisClickBreak > 8 then
begin
Callibrate('C');
MisClickBreak := 0;
Break;
end;
end;
end;
end;
end;
end;
freebitmap(Bone1);
freebitmap(Bone2);
freebitmap(Bone3);
freebitmap(Bone4);
end;


My function searches in 6 distinct blocks; it start center out and ends full screen, to make sure it cleans his own victims first.

EvilChicken!

2011-03-04 08:03:21

Would I be cheating if my suggestion was to utilize reflection?

WT-Fakawi

2011-03-04 08:08:58

0_o no reflection. Thats cheating within cheating ;)

Runescape Pro

2011-03-04 08:42:53

Good stuff WT, your the man. :)

I didn't check your script but are you utilizing the option text? Maybe if you store the option text for a certain square? You could make a square as not having bones. Just an idea.

Frement

2011-03-04 08:53:21

Does the problem occur with aprons and hats if there are no items covering it? Or is it for both situations? If its only when theres nothing to cover the stuff, then you could make a percentage check on how much white is found inside TBox (Made from the corners found).

YoHoJo

2011-03-04 14:42:02

What he said^. Count number of pixels, if it's too large (assuming bones tske up less space than apron or hat) then false. Or maybe even check the piles with too much white and Rick click to check for bones before moving onto next pile.