SRL Archive - OSR Help

BitMap help


Element17

2013-05-02 22:43:44

function FindDot: Boolean;           //change to spiral or something
begin
Dot := BitmapFromString(9, 7, 'meJy7c0X4DiGkq/efgfE/VnFxCZAU' +
'A8MXNCmQIFicgeEWmhQjAxDcYmA4DGRgmgkUxCqOFQEAHABfEw==');
FindBitmapSpiralTolerance(Dot, x, y, 569, 93, 676,184, 15);
DeBugBitMap(Dot);
HumanMMouse(x, y, 2, 2);
ClickMouse2(True);
if DeBug then Writeln('Found dots, flag present');
if WaitNotMoving(false) then
repeat
if DeBug then Writeln('Still Moving');
Wait(500 +Random(750));
until(WaitNotMoving(true) or not FlagPresent);
if DeBug then Writeln('Not moving, should be on dot');
Result := True;
FreeBitMap(Dot);
Exit;
end;

Everytime I try to run this my mouse just goes to the top left corner of RS.

senrath

2013-05-02 23:19:12

It's probably not finding the bitmap, so it's moving the mouse to position 0,0. Try changing it to this:

function FindDot: Boolean;           //change to spiral or something
begin
Dot := BitmapFromString(9, 7, 'meJy7c0X4DiGkq/efgfE/VnFxCZAU' +
'A8MXNCmQIFicgeEWmhQjAxDcYmA4DGRgmgkUxCqOFQEAHABfEw==');
if FindBitmapSpiralTolerance(Dot, x, y, 569, 93, 676,184, 15) then
begin
DeBugBitMap(Dot);
HumanMMouse(x, y, 2, 2);
ClickMouse2(True);
if DeBug then Writeln('Found dots, flag present');
if WaitNotMoving(false) then
repeat
if DeBug then Writeln('Still Moving');
Wait(500 +Random(750));
until(WaitNotMoving(true) or not FlagPresent);
if DeBug then Writeln('Not moving, should be on dot');
Result := True;
FreeBitMap(Dot);
end;
end;

Edit: Fixed the formatting.

Olly

2013-05-02 23:53:07

Could also do something like this to test if you can find the bitmap or not!

function foo(): boolean;
var
dot, x, y: integer;
begin
Dot := BitmapFromString(9, 7, 'meJy7c0X4DiGkq/efgfE/VnFxCZAU' +
'A8MXNCmQIFicgeEWmhQjAxDcYmA4DGRgmgkUxCqOFQEAHABfEw==');

result := findBitmapSpiralTolerance(Dot, x, y, 569, 93, 676, 184, 30);

if (result) then
writeln('-- We found the bitmap @ ' + toStr(point(x, y)))
else
writeln('-- Failed to find the bitmap!');

freeBitmap(dot);
end;

Element17

2013-05-03 02:00:44

Tried both and they still only work maybe 25 percent of the time. I am gonna need a back up, but not sure how to make it work. I have tired TPAs for the red dots on the MM but it never seems to work for me. Colors always change.

I use this in my script

WriteLn(ToStr(CountDots('red')) + ' Red dots present on Minimap.');   

It is always correct in giving me the number of red dots on the MM, anyway to take that and make it click them?

senrath

2013-05-03 02:07:10

Oh, yeah. Just use GetMiniMapDots('red'), which returns a TPA containing all the red dots. CountDots actually just calls Length on the result of GetMiniMapDots.