BraK
2010-06-10 14:37:02
I'm just getting started back scripting and I'm Making my new Fletcher.This is one of the funtions I made for it. I tested it and it works fine. Wondering what everyone else would think of it. Praise it, flame it, or criticize it. It does not matter any input would be appreciated. :)
Edit:Added scar tags. Just so everyone is on the same page. I don't use Fixed size windows so I don't use hard locations.
Edit2: Added Extra piece to only search a specific section of the screen for the bitmap.
Edit3: Made new funtion so that quadrant could be used on multiple procedures/functions. Moved debug into function.
program testxbank;
{$i srl/srl.scar}
Var
Brakdebug:boolean;
procedure Setupcwars;
Begin
Setupsrl;
brakdebug:=true;
end;
function Findbitmapquad( bitmap:integer; var x:integer; var y:integer; quad:integer): boolean;
//has 5 areas top left, top right, bottom left, bottom right, and center.
var
xs,xe,ys,ye,w,h:integer;
Begin
getclientdimensions(w,h)
case (Quad) of
1:begin xs:=2; xe:=(w/2); ys:=2; ye:=(h/2); end; //top left quadrant
2:begin xs:=(w/2); xe:=(w-2); ys:=2; ye:=(h/2); end; //top right quadrant
3:begin xs:=2; xe:=(w/2); ys:=(h/2); ye:=(h-2); end; //bottom left quadrant
4:begin xs:=(w/2); xe:=(w-2); ys:=(h/2); ye:=(h-2); end; //bottom right
5:begin xs:=(w/4); xe:=(w/4*3); ys:=(h/4); ye:=(h/4*3); end; //center square
End;
result:=FindBitmapin(bitmap,x,y,xs,ys,xe,ye)
end;
function xbank:boolean; //closes the bank using [x] button
var
Xbankbmp,x,y:integer;
begin
brakdebug:=True; // not gonna be part of script
xbankbmp:= BitmapFromString(16, 6, 'meJxT0jLMbu6NzK2MLqwRFpUAIkF' +
'h0YCUvMC0QggXiDyiU13DEsw9/Lm4uJS0DHNbJ4VkFgORb1IWRIGo' +
'hAwcARU7BkcDkYmLF1x9TFED0EygeiASk1WCI6CxbhFJUPX2HnD1Q' +
'PcAVQK1AJGsipaUoiqQBCKg4RDHIJsPcT/EfKAaBTVdOAJyIYqByM' +
'jRHc18iBpFTT2gGiACMiAIqNjePwJiPgB0HEdm');
result:=FindBitmapquad(xbankbmp,x,y,2)
Begin
If (result) then
begin
Mouse(x,y,5,5,true);
if brakdebug then
writeln('>>Close Bank function works<<') // will be part of script
end else
writeln('>>Closebank Failed<<')
End;
freebitmap(xbankbmp);
end;
begin
setupcwars;
if xbank then
Writeln('Woot');
end.
Edit:Added scar tags. Just so everyone is on the same page. I don't use Fixed size windows so I don't use hard locations.
Edit2: Added Extra piece to only search a specific section of the screen for the bitmap.
Edit3: Made new funtion so that quadrant could be used on multiple procedures/functions. Moved debug into function.