SRL Archive - SRL Archives

function findobjbmp;


elementalelf

2007-09-08 02:03:24

basically i copy/pasted findobj; and made it use a BMP instead of a color.
NOT USEFUL UNLESS THE THING BEING LOOKED AT HAS AN ARROW or something similar.

if this could be added to SRL4.0(non beta) it would make it alot easier for tut island scripts to run.

note: i havnt actually tested this out, but it should work as its only changing a few things and adding in a x and y difference.

how xdif and ydif works:

if you cant figure it out(which im sure most of you can)
when there is an arrow pointing at someone/something, usually when you mouse over teh arrow, the uptext doesnt come up, because your mouse isnt over the actual guy.
xdif and ydif lets you compensate for this.
for a tutorial island script, i would put

findobjbmp(x,y,0,15,'talk',arrow,10);

{*******************************************************************************
function FindObjbmp(var cx, cy, xdif, ydif: Integer; Text: String; bitmp, tolerance: Integer): Boolean;
By: Stupid3ooo and modified by Ron, modified again by anonymous to use bitmaps
Description: Finds Object using a bitmap.
*******************************************************************************}
function FindObjbmp(var cx, cy, xdif, ydif: Integer; Text: string; bitmp, tolerance: Integer): Boolean;
var
a, c, i, x1, y1, x2, y2: Integer;
begin
x1 := 245;
y1 := 165;
x2 := 277;
y2 := 185;
repeat
if (not (Loggedin)) then
Break;
a := a + 1;
if (a = 1) or (a = 3) then
c := c + 1;
for i := 1 to c do
begin
if (a = 1) then
begin
x1 := x1 + 30;
x2 := x2 + 30;
end else
if (a = 2) then
begin
y1 := y1 - 20;
y2 := y2 - 20;
end else
if (a = 3) then
begin
x1 := x1 - 30;
x2 := x2 - 30;
end else
if (a = 4) then
begin
y1 := y1 + 20;
y2 := y2 + 20;
end;
if (x1 = 485) and (x2 = 517) then
x2 := x2 - 2;
if (y1 = 325) and (y2 = 345) then
y2 := y2 - 7;
if (x2 > 515) then
Break;
if (FindbitmapinTolerance(cx, cy, color, x1, y1, x2, y2, tolerance)) then
begin
MMouse(cx+xdif, cy+ydif, 0, 0)
Wait(50+Random(50));
if (IsUpText(Text)) then
begin
Result := True;
Break;
end;
end;
end;
if (a = 4) then
a := 0;
until (x2 > 515) or (Result = True);
end;

n3ss3s

2007-09-08 02:08:52

Im pretty sure the function is FindBitmapToleranceIn, not FindBitmapInTolerance

But I dont know is that needed since SRL has FindObjectDeformed

elementalelf

2007-09-08 02:17:40

ahh, i didnt notice that one.

this will still work as the findobjdeformed doesnt have the xdif and ydif.

perhaps it would be better to just add that in rather then adding in a whole new procedure.
if people dont wanna use xdif ydif then just leave it as 0,0