SRL Archive - OSR Help

Searching for objects within the runescape "main" screen


msemtex

2012-08-05 14:27:01

Hi, I'am creating a bone collector.

This is the findbone procedure that finds bones until the inventory is full:



procedure FindBone;
var x, y: integer;

begin
if FindObj(x,y, 'ake', 15857114, 10) then
repeat
Mouse(x,y,2,2,false);
ChooseOption('ake');
repeat
Wait(1200+random(250));
Until not IsUpText('ew') or (InvFull);
until(InvFull);
end;


My issue is that it only searches within the very bottom right of the runescape "main" screen (Where your avatar is, and the action happens).

On a side note, how can I make the search better, how do I add more colour codes to the FindObj() line.

All help is appreciated.

Matt

Recursive

2012-08-05 16:06:43

Function by Mat:

function FindObj_pX(Mouse:Boolean;pX, pY,Null,Null2: Integer; Mod1,Mod2:Extended;Lol1:String): Boolean;
var
CTS, I: Integer;
TPA: TPointArray;
ATPA: Array of TPointArray;
begin
CTS := GetColorToleranceSpeed;
FindNormalRandoms;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(Mod1, Mod2);
If Not Mouse then
FindColorsSpiralTolerance(MSCX, MSCY, TPA,Null, 190, 140, 320, 230, Null2) else
FindColorsSpiralTolerance(MSCX, MSCY, TPA,Null, MSX1, MSY1, MSX2, MSY2, Null2);

ColorToleranceSpeed(CTS);
ATPA := TPAToATPAEx(TPA, 15, 15);
For I := 0 to High(ATPA) do
begin
MiddleTPAEx(ATPA[i], pX, pY);
If Mouse then
begin
MMouse(pX, pY, 2, 2);
Wait(300+Random(75));
If(IsUpTextMultiCustom([Lol1])) then
begin
Result := True;
GetMousePos(pX, pY);
Break;
end;
end else
Result := True;
end;
end;

Example of use:

If FindObj_pX(false,pX,pY,13890040,3,0.13, 6.73,'asket') then
begin
ClickMouse2(True);
Wait(2000+Random(200))
Result := True;
end;

function FindObj_pX(Mouse:Boolean;pX, pY,Null,Null2: Integer; Mod1,Mod2:Extended;Lol1:String): Boolean;

Mouse: Set to false if you want to search the entire screen, set to true to search within these coordinates:190, 140, 320, 230, not sure what area they cover but you can find out.

px, py: mouse coordinates when pointing to the object

Null, NUll2 : Null is color and Null2 is tolerance

Mod1, Mod2: Mod1 is hue, Mod2 is Sat

Lol1: uptext

riwu

2012-08-05 17:59:09

Use FindObjEx if you dont know about TPA. When you want a more customizable version of a function always check if there is a +Ex version of it. xs, ys, xe, ye is the search radius so if you want it to search within mainscreen set it as MSX1,MSY1,MSX2,MSY2