Simba Code:
//============================================================================//
// function PanelScreen: Boolean;
// -Returns true if the Panel screen is up.
//============================================================================//
{function PanelScreen: Boolean;
begin
Result := CountColorTolerance(2929149, 497, 23, 509, 34, 5) >= 15; // Orange 'X'
end;}
// You would need to modify this one because the shop screen has the same 'X' in the same position.
//============================================================================//
// function StatusScreen: Boolean;
// -Returns true if the Status screen is up.
//============================================================================//
function StatusScreen: Boolean;
begin
Result := CountColorTolerance(2929149, 412, 51, 430, 70, 5) >= 15; // Orange 'X'
end;
//============================================================================//
// function PanelIndexToPoint(i: Integer): TPoint;
// -Converts the Panel Index 'i' into a Panel Point (row, column). eg.
// The first slot : '1' --> (1, 1)
// The fourth slot: '4' --> (4, 1)
//============================================================================//
function PanelIndexToPoint(i: Integer): TPoint;
begin
i := i - 1;
Result := Point((i mod 4) + 1, Floor(i div 4) + 1);
end;
//============================================================================//
// function PanelPointToBox(row, col: Integer): TBox;
// -Converts the Panel Point ('row', 'col') into the Panel Bounds (TBox).
//============================================================================//
function PanelPointToBox(row, col: Integer): TBox;
begin
row := row - 1;
col := col - 1;
Result.X1 := (24 + ((row) * 50));
Result.Y1 := (80 + ((col) * 50));
Result.X2 := (63 + ((row) * 50));
Result.Y2 := (119 + ((col) * 50));
end;
//============================================================================//
// function PanelIndexToBox(i: Integer): TBox;
// -Converts the Panel Index 'i' into the Panel Bounds (TBox).
//============================================================================//
function PanelIndexToBox(i: Integer): TBox;
var
P: TPoint;
begin
P := PanelIndexToPoint(i);
Result := PanelPointToBox(P.X, P.Y);
end;
//============================================================================//
// function PanelIndexSelected: Integer;
// -Returns the Panel Index that is currently selected.
// -Returns -1 if no panel selected.
//============================================================================//
function PanelIndexSelected: Integer;
var
i, q, p: Integer;
B: TBox;
begin
if not PanelScreen then Exit;
for i:=1 to 8 do
begin
B := PanelIndexToBox(i);
if FindColorBoxTol(q, p, 1290732, 5, B) then
begin
Debug('PanelIndexSelected: ' +IntToStr(i));
Result := i;
Exit;
end;
end;
Result := -1;
end;
Simba Code:
//============================================================================//
// function FindColorBoxTol(var x, y: Integer; col, tol: Integer; b: TBox): Boolean;
// -a more concise way of finding the colour 'col' (with tolerance) in a box.
// (Uses the record TBox instead of individual points.
//============================================================================//
function FindColorBoxTol(var x, y: Integer; col, tol: Integer; b: TBox): Boolean;
begin
Result := FindColorTolerance(x, y, col, b.X1, b.Y1, b.X2, b.Y2, tol);
end;
Simba Code:
// Co-ords for Big Blue Button:
MouseBox(238, 160, 282, 204, Mouse_Left);