SRL Archive - OSR Help

Bitmap help


spudz

2011-12-09 22:44:33

i am making a simple script for a private server to bot prayer, i am having trouble with bitmaps, im finding the altar using a bitmap (not the best option but i just wanted to learn how to use the bitmap functions) however the script finds the altar but im just wondering how do i move my mouse to the altar.

code

program pwnprayer;

Var
altar, X, Y:Integer;


procedure findaltar1;



begin

altar:= BitmapFromString(23, 20, 'meJyllEEKgzAQRc8gFIQe34WIYi' +
'WiKKK0tHgOF72GxQ4MfH6nxhYiD3GTN9/JJOv6WsPYtk3ecXwenJu' +
'nCVzbFgxVxfRlCbqiYMk8jj5uXQfGugYilIUseQwD2FV9ZHNOOZAc' +
'CtMPnNOWLJJUmApALfpc1JZImvVpvnoE5TgCosCUElUXQKIfBCM5d' +
'b+PMGoXiy0Q==');

If (FindBitmap(altar, X, Y)) Then
Writeln('Found the altar bitmap')


Else
Writeln('Could not find altar');


End;


procedure findbones1;


begin

MoveMouse(577,224);
wait (50);
ClickMouse(577,224,Mouse_right);
wait (500);
MoveMouse(577,262);
wait (300);
ClickMouse(577,262,Mouse_left);
SetTargetBitmap(altar);

end;




begin
findaltar1;
findbones1;
end.





so how would i move the mouse to the position of the bitmap.

first ever attempt at making something using simba or scar.

mormonman

2011-12-09 22:54:45

FindBitmap returns the coordinates of the bitmap in X and Y. Just change your if then statement into an if-then begin end else statement and then add a movemouse and clickmouse inside the new begin-end section.

You will also probably want to use better waits inbetween mouse movements. I don't know if the private server has a banning system, but its good practice to add Random(numberhere) to your waits.

if FindBitmap(altar, X, Y) then
begin
WriteLn('Found altar, clicking it');
MoveMouse(X, Y);
Wait(50 + Random(25));
ClickMouse(X, Y, mouse_Left);
Wait(50 + Random(25));
end else
WriteLn('Altar not found');

Also, remove SetTargetBitmap(altar) as that will change what simba is targeting with its input and output functions(and you can't target a bitmap loaded in the memory with the mouse or keyboard very well ;) ).

You will probably want to loop the altar and bone clicking so throw a repeat-until in there.


begin
repeat
findaltar1;
findbones1;
until False;
end.

Finally you will want to only load the bitmap once and then free it at the end of the script, so that you do not create a memory leak.

begin
altar := BitmapFromString(23, 20, 'meJyllEEKgzAQRc8gFIQe34WIYi' +
'WiKKK0tHgOF72GxQ4MfH6nxhYiD3GTN9/JJOv6WsPYtk3ecXwenJu' +
'nCVzbFgxVxfRlCbqiYMk8jj5uXQfGugYilIUseQwD2FV9ZHNOOZAc' +
'CtMPnNOWLJJUmApALfpc1JZImvVpvnoE5TgCosCUElUXQKIfBCM5d' +
'b+PMGoXiy0Q==');
repeat
findaltar1;
findbones1;
until False;
FreeBitmap(altar);
end.

spudz

2011-12-10 06:26:24

i managed to make the bone altar script and added banking, found out half way throught that a bitmap was not the best way to find the altar so had to change it to another method, my first working script. couldn't of done it without you :)

i used the bitmap function to find the bones instead which worked out awesome.