SRL Archive - SRL Archives

RotateTilBitmapFound.


Roberty Bob

2006-06-16 06:03:19

RotateTilBitmapFound( Bitmap, Xs, Ys, Xe, Ye, rotation increment)

Ok so I want to test the waters with this one before I make it… I know you can use deformed Bitmap searches but feel this is a bit different.

I just think it would be good to have a procedure that rotates the minimap in tiny increments (which could be a variable of the procedure) until a BMP is found within a small area.

It could rotate between two given angles or whatever… and be extended easily to DTM's also.

Potential Applications… I think there are quite a few… but bank opening is certainly one… it would rotate until it finds the line of yellow banker dots on the MM for example. (a DTM) General minimap alignment to take out user variability??

Sometimes finding a BMP on the screen can be problematic… by looking in a specific location and rotating in small increments… it would be found better…

It could have failsafes (one full rotation) etc.

In terms of problems.. I think detection would be the main one…?

tell me what you think.

EDIT FAWK: Moved

Pyro

2006-06-17 00:47:17

Nice idea. I think Mutant made one already just hasnt put it fully into srl. Correct me if im wrong. But one question. Does it hold down the arrow key and spin while looking. OR does it hit key then look then hit key then look then hit key then look etc

WhiteShadow

2006-06-17 01:23:26

{ Rotates RTimes times. Or until Bitmap is found.
d and Wt fill in the SendArrowSilentWait(a: byte; WaitTime : Integer);
BmpName = Bitmap name. bx, by = stores Bmp position
z1, z2, z3, z4 = box around Bitmap
RTimes = Rotatetimes until function ends }
function BmpRotate(d : Byte; Wt, BmpName, bx, by, z1, z2, z3, z4, Rtimes : Integer) : Boolean;
var
K : Integer;
begin
repeat
K:= K + 1
SendArrowSilentWait(d, Wt);
until(FindBitMapIn(BmpName, bx, by, z1, z2, z3, z4)) or (K >= RTimes)
Result:= True
end;

Something like this?

Roberty Bob

2006-06-17 04:55:16

Yeah just like that… I was thinking of hit spin hit spin hit spin etc… my application is for my smither.

a) to find the bankers beautifully every time then rotate back to true north or whatever once banked… (not happy with current SRL bankers :p they don't always work well in VWBank.)
b) to find my anvil bmp if it can't get the angle right… I can limit where the anvil is in mainscreen by the use of my DTM's so it would be quick enough to just search the centre of MS for example.

thanks. I'll see how i go with it.

Roberty Bob

2006-06-25 23:59:45

function RBobCompass(MouseActive:boolean) : Boolean;
makes the compass face north currently.

I know there are already SRL calls for that… but this can very easily be modified for any given compass orinentation by just changing z1->z4 and the BMP.
The only argument to pass in is whether the mouse is currently active in the window or not. (for SendArrowSilentWait reasons.)
thanks Whiteshadow for some inspiration. :D

[PHP]function RBobCompass(MouseActive:boolean) : Boolean;
var z1, z2, z3, z4, RotDur,Count,BMPtol, bx,by, RNumber,North: Integer;
var ArrowByte: Byte;
begin
RotDur:=50;
ArrowByte:=1;
BMPtol:=15;
RNumber:=100;
z1:= 567 ;
z2:= 7;
z3:= 571;
z4:= 12;
North := BitmapFromString(2, 3, 'z78DA337633000263BC240088' +
'CE0757');

if not(MouseActive) then
mouse(533,44,15,15,True);

SendArrowSilentWait(3, 150+random(100));
repeat
Count:= Count + 1
SendArrowSilentWait(ArrowByte, RotDur+random(20));
until(FindBitmapSpiralTolerance(North,bx, by, z1, z2, z3, z4,BMPtol)) or (Count >= RNumber)
Result:= True
end;[/PHP]

tarajunky

2006-06-26 10:30:49

I made my own makecompass for my chickenkiller script. Instead of rotating until the compass says 'N', it rotates around north until it finds a horizontal straight line.

The line I use is based on a DTM with a little bit of size tolerance for the angle, kinda like this…


. . o o O O

After all, the point of rotating the minimap is to have the MINIMAP oriented, not the compass. Jagex purposely makes it so the compass and minimap are not perfectly aligned, so aligning based on the compass is kind of silly if you ask me.

WhiteShadow

2006-06-26 14:16:07

I made a wonderful, VW banker. OpenBank5, its only takes like a couple of seconds.

Roberty Bob

2006-07-01 13:06:15

since I've had this idea I've learnt a lot and its got a lot smarter… and its ideal for banking.

I'll be making a SRL Member release of a bankopener soon….

function BankOpener(bankname,bankslot) will open any ftp bank and slot specified, starting from anywhere even near the bank.

I already have it in a 100% bugfree form, but it is currently too specific to fally east for a T34M P3rf3c7 script I'm working on, so i just need to generalise it… :D

rotating DTM searching and findbitmapspiraltolerance is the basis of it.

QQu

2006-07-01 21:10:27

From: tarajunky
I made my own makecompass for my chickenkiller script. Instead of rotating until the compass says 'N', it rotates around north until it finds a horizontal straight line.

The line I use is based on a DTM with a little bit of size tolerance for the angle, kinda like this…


. . o o O O

After all, the point of rotating the minimap is to have the MINIMAP oriented, not the compass. Jagex purposely makes it so the compass and minimap are not perfectly aligned, so aligning based on the compass is kind of silly if you ask me.



My friend got banned for letting his RS2 screen spin around and take it back off, he didn't use any Scripts at all, just a Heavy Object to hold down the Right-Arrow key and Jagex though he was Macroing sadly… He was Combat Level 103.

tarajunky

2006-07-02 00:53:24

Sorry to hear about your friend, and his Heavy Object.

The key for a minimap specific angle search is to use a reference point (the compass angle) to set limits. So, if you expect minimap north to be within +/- 25 degrees of Compass North, then you only allow it to rotate between +/- 30 degrees of Compass North before stopping.

If somebody writes a procedure that will spin forever if there aren't any white lines on the minimap, they deserve to get banned. :) It breaks one of the golden rules of autoing, which is to make sure that you break out of every loop.

Roberty Bob

2006-07-02 11:45:55

Wow thats unfortunate for your friend, although he was breaking rule 7

He was "playing" Runescape AFK (away from keyboard) :p
still that is so stupid…

A surprisingly powerful technique for MM alignment (as opposed to compass) is by using a getcolor() toward the edge of the MM as the loop condition… since it only has to check one pixel -> really fast. You do need the exact color though of course…