SRL Archive - Help and Support

[Help]-Finding+Click a bitmap


Flat Line

2006-07-05 13:00:26

Alright so heres my problem: i need to find a bitmap and then click it. heres what im using:
FindBitmap(bitmap: Integer; var x, y: Integer): Boolean;


and heres what i have:
findbitmap(*____*.bmp, x, y);

is that right so far? then what do i do?:confused: any help will be greatly appriciated! :D :D :D

do i also need to have used: LoadBitmap(path: string): Integer;?

WhiteShadow

2006-07-05 18:13:23

From: Flat Line
Alright so heres my problem: i need to find a bitmap and then click it. heres what im using:
FindBitmap(bitmap: Integer; var x, y: Integer): Boolean;


and heres what i have:
findbitmap(*____*.bmp, x, y);

is that right so far? then what do i do?:confused: any help will be greatly appriciated! :D :D :D

do i also need to have used: LoadBitmap(path: string): Integer;?


[PHP]//Explaination for Bitmap.
program New;
{.include SRL/SRL.Scar}

var
BmpName : Integer;//Declare Bitmap as a variable integer

procedure LoadMe;//Put in Mainloop once
begin
BmpName:= BitmapFromString(23, 19, 'z78DAEDC18100000000C320BBF923' +
'5DE100550100C06BDD7BCD13'); //xD, replace your bitmap with mines
end;

procedure ClickBmpPl0x;
begin
if(FindBitmap(BmpName, x, y))then
//bitmap : Integer; = variable you put it as in this case it is BmpName.
//the x, y = it's position to save it as.
begin
Writeln('Found Bitmap');
Mouse(x, y, 1, 1, true);//Clicks the coords of Bitmap;
end;
end;

begin
SetUpSRL;
LoadMe;
ClickBmpPl0x;
end.[/PHP]

Please ask any further questions, for extra help I recommend reading some bitmap tutorials in the tutorial island section. :)

Flat Line

2006-07-05 19:31:08

Wow, thanks a lot. this really helps me. :D:D:D thanks again for your help

muna580

2006-07-05 21:19:49

Can I ask a question. I don't really understand how bitmap works. Like bitmap is a very small picture which conatins diffrent colors. But then how does that bitmap work in all Worlds. All the worlds have diffrent color.

Cruel

2006-07-06 02:48:08

From: muna580
Can I ask a question. I don't really understand how bitmap works. Like bitmap is a very small picture which conatins diffrent colors. But then how does that bitmap work in all Worlds. All the worlds have diffrent color.

That's what tolerances are for.

And it's only the main game screen and minimap that are random colors. So bitmaps work very well for detecting messages and screens in chatbox as well as inventory items and right-click menu items…
In all other cases, a tolerance is needed.