Log in

View Full Version : Bitmap script, compiles but dosn't find.



shadows-collide
06-23-2007, 10:41 AM
Hey I only started scripting yesterday, and have tried not to post with nooby questions as much as possible, I can now get other peoples script to work provided they are compatible with SCAR Divi 3.06, so i started writing some of my own, i breezed through the Begginer Tut and then got the the Intermediate one where it gets a little more complicated. I made this script to click on the Quest icon in your inventory. But it dosnt... Even though it compiles properly, Is it something to do with my Bitmap not being big enough? All the Bitmaps i have seen have been huge! It simply stays at the top left hand of the RS window... Im glad it compiles though, I guess im doing something right!



Program FirstBitmap;//Program Name

Var // Declares Variables

x, y, Bitmap:Integer; //States Variables that are going to be used


//Declares the Bitmaps that are going to be used.
Procedure DeclareBitmaps;
Begin
Bitmap := BitmapFromString(16, 1, 'z78DA733670C60341C00245C4' +
'0D03581880A001542D0C1A404900218E1574');
End;


//Procedure that clicks on the Bitmap
Procedure ClickBitmaps;
Begin
Wait(250+random(43))
movemousesmooth(x,y)
wait(32+random(12))
clickmouse(x,y,true)
End;

//Procedure that finds the Bitmap
Procedure FindBitmaps;
Begin
If(FindBitmap(Bitmap, x, y)) Then
ClickBitmaps;
End;

//The main loop
begin
repeat
Wait(1300+random(100))
DeclareBitmaps;
FindBitmaps;
ClickBitmaps;
Wait(5000)
until(false)
end.



Many thanks!

me_ntal
06-23-2007, 11:22 AM
OK starters change:
movemousesmooth(x,y)
wait(32+random(12))
clickmouse(x,y,true)
to
Mouse(x,y,3,3,true)

Secondly you call clickbitmap twice during FindBitmaps and the main loop. Maybe it isnt finding the bitmap?

shadows-collide
06-23-2007, 11:31 AM
No i dont think that's the problem... When i write in mouse it says unknown identfier too, do i need an include?

Many thanks,

- Shadows-collide -

Markus
06-23-2007, 11:47 AM
For mouse you need to use SRL.
You include SRL by putting on top of your script:

{.include srl/srl.scar}

To start srl, add SetupSRL; as the first command in your script.

Oh, and you should read a tutorial about standards BTW, you don't have good ones.

neG
06-23-2007, 12:10 PM
Program FirstBitmap;//Program Name
{.include SRL/SRL.scar}
//This includes the SRL include.

Var // Declares Variables
Bitmap:Integer; //States Variables that are going to be used


//Declares the Bitmaps that are going to be used.
Procedure DeclareBitmaps;
Begin
Bitmap := BitmapFromString(16, 1, 'z78DA733670C60341C00245C4' +
'0D03581880A001542D0C1A404900218E1574');
End;


//Procedure that clicks on the Bitmap
Procedure ClickBitmaps;
Begin
Mouse(x,y,3,3,true);
End;

//Procedure that finds the Bitmap
procedure FindBitmaps;
begin
if(FindBitmap(Bitmap, x, y)) then
ClickBitmaps;
end;

//The main loop
begin
SetupSRL;//After including the SRL include, you add this.
repeat
Wait(1300+random(100))
DeclareBitmaps;
FindBitmaps;
ClickBitmaps;
Wait(5000)
until(false)
end.

That should work.
I wrote what I changed in there so you know.
It was mostly using mouse; include srl, and setupsrl tho :P