SRL Archive - OSR Help

Can't find Bitmap


void_hatred

2010-02-19 05:16:16

hey guys,
so I'm still working on a script of mine but I've came to a halt

what I'm basically wanting to do is open inv_Magic and then check for my HomeBMP, if it's visible then click it (if I get the message saying that we've already done it then Result is false :))

my bitmap function is..


function HomeTele: Boolean;
var
HomeBMP, x, y: Integer;
begin
GameTab(tab_Magic);

HomeBMP := BitmapFromString(7, 9, 'beNpjYFi48Vpl46Ka2KVAVFa' +
'7ZN66GwwMDEnRxVHuhbVJC4Eo2r0QyAUKhtvWfX33Tc/IC4iADCAX' +
'KOhrkP7mwWtxfhEgAjKAXKCgk2zkpBmHpiw9AERABpALFLSSiFq67' +
'iorAy8QARlALlBQl9+ts3WHPLsBEAEZugJuQEEHs0xRBlkXtUwgAj' +
'JsdDIZsAIA3wk60g=='
);

if FindBitmapToleranceIn(HomeBMP, x, y, MIX1, MIY1, MIX2, MIY2, 4) then
begin
Mouse(x, y, 3, 3, true);
end else
begin
Result := false;
Exit;
end;

Wait(RandomRange(750, 1500));

Result := not FindTextTPA(clBlack, 30, MCX1, MCY1, MCX2, MCY2, 'ait', SmallChars, Nothing);
FreeBitmap(HomeBMP);
end;

then I composed another method using TPAs:


function HomeTele: Boolean;
var
x, y: Integer;
TPA: TPointArray;
begin
GameTab(inv_Magic);

FindColorsTolerance(TPA, 10832730, MIX1, MIY1, MIX2, MIY2, 10);
SortTPAFrom(TPA, Point(MIX1, MIY1));

MMouse(TPA[0].x, TPA[0].x, 3, 3);

if WaitUpText('umb', 250) then
begin
GetMousePos(x, y);
Mouse(x, y, 0, 0, true);
end else
begin
Result := false;
Exit;
end;

Wait(RandomRange(750, 1500));

Result := not FindTextTPA(clBlack, 30, MCX1, MCY1, MCX2, MCY2, 'ait', SmallChars, Nothing);
end;

… and then I came up with another way using (A)TPAs, so i'm not sure which would be better to use (feedback on which to use would be appreciated!)

any ways, here's the (A)TPA version, it just checks for a blue-ish color and clicks [0][0]


function HomeTele: Boolean;
var
x, y: Integer;
TPA: TPointArray;
ATPA: T2DPointArray;
begin
GameTab(tab_Magic);

FindColorsTolerance(TPA, 10832730, MIX1, MIY1, MIX2, MIY2, 10);
ATPA := TPAToATPAEx(TPA, 20, 20);

MiddleTPAEx(ATPA[0], x, y);

MMouse(x, y, 3,3 );

if WaitUpText('umb', 250) then
begin
GetMousePos(x, y);
Mouse(x, y, 0, 0, true);
end else
begin
Result := false;
Exit;
end;

Wait(RandomRange(750, 1500));
Result := not FindTextTPA(clBlack, 30, MCX1, MCY1, MCX2, MCY2, 'ait', SmallChars, Nothing);
end;

thanks in advance for anyone that helps :)

void_hatred

Frement

2010-02-19 05:17:17

Instead of a bitmap, try using a color with tolerance. In box where it should be. (The blue color).

Kasi

2010-02-19 13:46:19

It's Probs just you bitmap this works fine for me

function HomeTele: Boolean;
var
HomeBMP, x, y: Integer;
begin
//GameTab(tab_Magic);

HomeBMP := BitmapFromString(5, 7, 'beNo78ujv37+mLsFJvh1A8i8YWFta' +
'hdsXAkkIV09TH4KA7E1HHqEhOUl9CIJwJVjlTeQCgCQ6FwBIXjW9');

if FindBitmapToleranceIn(HomeBMP, x, y, MIX1, MIY1, MIX2, MIY2, 4) then
begin
Mouse(x, y, 3, 3, true);
end else
begin
Result := false;
Exit;
end;

Wait(RandomRange(750, 1500));

Result := not FindTextTPA(clBlack, 30, MCX1, MCY1, MCX2, MCY2, 'ait', SmallChars, Nothing);
FreeBitmap(HomeBMP);
end;
Commented out the gametab bit cus i ned it was already on the correct gametab

Coh3n

2010-02-19 15:13:53

Well since the symbol never moves, why not just do a GetColor. If the GetColor is right, then MouseBox.

if (GetColor(234, 432, ColorHere) then
MouseBox(x1, y1, x2, y2, 1);

If you wanted more, you could replace MouseBox with a MMouse, followed by an uptext check, etc.