SRL Archive - OSR Help

[RSPS / Basic question] Checking for interfaces?


Twinki

2014-03-02 03:57:05

I'm wondering what'd be the best thing to use, to check if an interface is on the screen, I was thinking of bitmaps. IDK how reliable that is though.

The interfaces i'm mainly going to be checking are ones like:
http://gyazo.com/6138fe638fd2c1d08988509973752e3d.png This

riwu

2014-03-02 04:40:02

bitmaps, color counts, text reading… they are all pretty reliable for this.

Pakyakkistan

2014-03-08 10:35:35

You can set up a DTM or a Bitmap for the [x] in the top right hand corner. Used to do something very similar back in the day when I worked with SCAR. If you call for this, you will also be able to call for it to close the interface screen as well.

Frement

2014-03-14 06:09:46

Count the orange color, use that as the "ID".

rj

2014-03-14 15:55:07

I had a lot of functions for interfaces in my include

(*
Author: Officer Barbrady
Description: Gets text within x coords
*)

function getSimpleText(Colors:TIntegerArray;x1, y1, x2, y2:integer;font:string):String;
var
textTPA:TPointArray;
textATPA, textATPAS:T2DPointArray;
i:integer;
textStr:string;
begin
setLength(textATPAS, length(colors));
for i := 0 to high(colors) do
findColors(textATPAS[i], Colors[i], x1, y1, x2, y2);
textTPA := mergeATPA(textATPAS);
textATPA := SplitTPAEx(textTPA, 1, 10);
filtertpasbetween(textatpa, 0, 1);
SortATPAFromFirstPointX(textATPA, Point(0, 0));
result := getTextATPA(textATPA, 3, font);
end;

(*
Author: Officer Barbrady
Description: Interface TPA
*)
function _317_getInterfaceTPA:TPointArray;
var
tempResult:TPointArray
begin
// change mainscreen.bounds to x1 y1 x2 y2 of the mainscreen
findColorsTolerance(tempResult, 3358536, mainscreen.bounds, 3);
result := tempResult;
end;

(*
Author: Officer Barbrady
Description: Gets open interface bounds
*)

function _317_getInterfaceBounds:TBox;
begin
result := getTPABounds(_317_getInterfaceTPA);
end;

(*
Author: Officer Barbrady
Description: Returns true if interface is open
*)

function _317_interfaceOpen:boolean;
begin
result := (length(_317_getInterfaceTPA) > 1000);
end;

(*
Author: Officer Barbrady
Description: Gets name of interface
*)

function _317_getInterfaceName:string;
var
b:TBox;
begin
if (not _317_interfaceOpen) then
exit;
b := _317_getInterfaceBounds();
b.y2 := b.y1 + 40;
result := getSimpleText([2070783, 37375, 65535], b.x1, b.y1, b.x2, b.y2, 'upchars07');
end;
(*
Author: Officer Barbrady
Description: Closes interface
*)

procedure _317_closeInterface;
var
b:TBox;
text:string;
begin
if (not _317_interfaceOpen) then
exit;
b := _317_getInterfaceBounds();
mouse(b.x2 - 15, b.y1 + 5);
end;

Colors will have to be changed though, can you link me to the server?
@Twinki;