I was walking past some doors and I thought that maybe I should make a door opener, nobody likes opening doors, they're always a trouble, so, I made this function - its simple but works.
I recommend using OpenDoor(True) so it will rotate, because when door is closed, outer side of it is pretty much darker than the inner side, and when door is open its the opposite, so use the rotation.
You are free to use, just credit me properly.
SCAR Code:
Function OpenDoor(Rotate: Boolean): Boolean;
Var
TPA, TPA2: TPointArray;
C, X, Y, I: Integer;
TP: TPoint;
Begin
If(Not(LoggedIn))Then Exit;
For I := 0 To 3 Do
Begin
FindColorsSpiralTolerance(MSCX, MSCY, TPA, 2189191, 20, 20, MSX2 - 10, MSY2 - 10, 10);
For C := 0 To GetArrayLength(TPA) - 1 Do
Begin
TP := TPA[c];
FindColorsTolerance(TPA2, 2189191, TP.x - 25, TP.y - 25, TP.x + 25, TP.y + 25, 10);
If(GetArrayLength(TPA2) > 150)Then
Begin
MiddleTPAEx(TPA2, X, Y);
MMouse(X, Y, 5, 5);
If(Pos('lose', GetUpText) > 0)Then
Begin
Result := True;
Exit;
End Else
Begin
If(Pos('pen', GetUpText) > 0)Then
Begin
GetMousePos(X, Y);
Mouse(X, Y, 1, 1, True);
Result := True;
Exit;
End;
End;
End;
End;
If Not Rotate Then
Begin
Exit;
End Else
Begin
ActivateClient;
Wait(125 + Random(25));
SendArrowSilentWait(1, 1100 + Random(150));
End;
End;
End;