PDA

View Full Version : New procedure getMMSize;



KM_01
11-23-2013, 05:20 AM
Can someone please test this for me? It's a quick proc to scan for Minimap Dimensions, I've made it prefer the left-side of the border to avoid confusion when used in a script. The top, bottom, and right border co-ords are the inner-most pixel of the border.
I was having issues using normal math to find the left border (it would probs work for everyone else) so I left it working for my weird setup.. I want to see how universal this proc is, so please test.
Set-up: OSR preset, interfaces non-transparent, slim headers, MM snapped to the top-right corner, log in, target the SMART window and press play.

program new;
{$DEFINE SMART}
{$i srl-6/srl.simba}

procedure getMMSize;
var MM_Border_Right, MM_Border_Left, MM_Border_Top, MM_Border_Bottom, ySearch, counter, x, y, w, e : Integer; didFind : Boolean;
begin
if findcolor(x,y,4405803,IntToBox(955, 39, 957, 41)) then
begin
MM_Border_Right:= x;
writeln('Detected MM right border at '+inttostr(MM_Border_Right)+'');
if findcolor(x,y,3879459,IntToBox(954, 14, 955, 16)) then
begin
MM_Border_Top:= y;
writeln('Detected MM top border at '+inttostr(MM_Border_Top)+'');
end;
counter:= 15;
if (MM_Border_Top > 0) then
begin
counter:= MM_Border_Top + 1;
end else
writeln('Couldn''t find MM top border');
repeat
counter:= counter + 1;
if findcolor(x,y,5458491,IntToBox(954, MM_Border_Top+1, 955, counter)) then
begin
MM_Border_Bottom:= y;
writeln('Detected MM bottom border at '+inttostr(MM_Border_Bottom)+'');
counter:= 545;
end;
until(counter >= 545);
if (MM_Border_Bottom > 0) then
begin
ySearch:= round((MM_Border_Bottom - MM_Border_Top) / 2);
end else
writeln('Couldn''t find MM bottom border');
counter:= MM_Border_Right;
didFind:= false;
repeat
//if (counter > 10)then
counter:= counter - 10;
if findcolor(x,y,4405803,IntToBox(counter, ySearch-2, MM_Border_Right-1, ySearch+2)) then
begin
if findcolor(w,e,4405803,IntToBox(counter-5, ySearch-2, MM_Border_Right-1, ySearch+2)) then
begin
MM_Border_Left:= w;
didFind:= true;
end else
begin
MM_Border_Left:= x;
didFind:= true;
end;
end;
until(counter <= 1 or didFind);
if didFind then
begin
writeln('Detected MM left border at '+inttostr(MM_Border_Left)+'');
end else
writeln('Couldn''t find MM left border');
end else
writeln('Couldn''t find MM right border');
end;

begin
clearDebug();
setupSRL();
getMMSize;
end.

bonsai
11-23-2013, 02:03 PM
Results from a basic login using std (to date) srl6....


---- initSmart()
---- Waiting up to 5 minutes for RS to load...
------ minimap.__createMask(): Creating the bitmap mask
---- Succesfully found and set the minimap bounds @ {X1 = 735, Y1 = 13, X2 = 959, Y2 = 224}
---- TRSActionBar.__find()
------ ERROR: Failed to find action bar minimize button
---- TRSActionBar.__find(): False
---- TRSChatbox.__find()
------ Looking for chat text border...
-------- TRSChatbox._findTextBorder(): No chat tab is open
------ Looking for the emote tab...
-------- TRSChatbox._findEmoteBorder(): Didn't find text background color
------ Looking for the quick chat interface...
-------- Didn't find quick chat border
---- TRSChatbox.__find(): False
------ TRSMainscreen.__find(): Set mainscreen bounds based on the other visible interfaces
---- Client is ready.
---- Setup SRL in 188ms.
-- setupSRL(): True
Detected MM right border at 956
Couldn't find MM top border
Detected MM bottom border at 12
Couldn't find MM left border
-- Freeing gametabs bitmaps...
-- Succesfully freed SMART[3364]
-- Freeing the minimap mask
Successfully executed.

euphemism
11-23-2013, 09:48 PM
As far as I know, SRL-6 has dynamic minimap finding, and I think I wrote it? Is it not working?

Coh3n
11-24-2013, 06:14 PM
As far as I know, SRL-6 has dynamic minimap finding, and I think I wrote it? Is it not working?It worked fine, but unfortunately has been removed now that we've moved to fixed screen.

@OP, I'm going to move this to snippets. :)