Element17
2012-04-20 20:28:46
Would it be better to use findchat or dtm? I wanna use this as a fail safe to make sure I opened the guild door.
2012-04-20 20:28:46
2012-04-20 20:30:09
2012-04-20 20:42:46
2012-04-20 20:49:40
function GetColorsBox(x1, y1, x2, y2: Integer; ClearSameColors: Boolean): TIntegerArray;
begin
Result := GetColors(TPAFromBox(IntToBox(x1, y1, x2, y2)));
if (ClearSameColors) then
ClearSameIntegers(Result);
end;
2012-04-20 21:23:12
2012-04-20 21:58:46
Procedure OpenDoor;
Var Tries: Integer;
Begin
Repeat
If(Not(LoggedIn))Then Exit;
Tries := Tries + 1;
If(Tries = 5) Then
Writeln('Failed Five times');
If DoorFinder(X, Y) Then
Case Random(2) of
0: Mouse(X, Y, 2, 2, True);
1: Begin
Mouse(X, Y, 2, 2, False);
WaitOption('pen', 500);
End;
End;
Wait(1000);
While IsMoving Do
AntiBan;
Wait(750+Random(200));
Until(FindColor(x, y, 0, MCX1, MCY1, MCX2, MCY2));
If FindColor(x, y, 0, MCX1, MCY1, MCX2, MCY2) Then
Writeln('Foudn and clicked door!');
End;Procedure OpenTheDoor; //newer door opener, thanks Flight
var
x, y, COUNTER: integer;
begin
If FindObj(x,y,'pen', 2117737, 5) then //2581379
Begin
WriteLn('Opening Door...');
ClickMouse2(True);
COUNTER := 0;
if not DidRedClick and (COUNTER<20) then //If we missed, then exit so we can try again
begin
OpenTheDoor;
inc(COUNTER);
end;
While IsMoving do
Wait(100);
//Maybe wait a little longer?
end else if FindObj(x,y,'lose', 2117737, 5) then //The door is already open, so let's exit
Exit;
end;
2012-04-21 16:44:14
function OpenDoor : Boolean;
var Tries: Integer;
begin
Result:= ((GetColor(X1, Y2) = 0) and GetColor(X2, Y2) = 0)); //X1, X2, Y1, Y2 are co-ords where black is found in the chat box when the door is opened
repeat
if(not(LoggedIn))then
Exit;
Inc(Tries)
if DoorFinder(X, Y) then
case Random(2) of
0 : Mouse(X, Y, 2, 2, True);
1 : begin
Mouse(X, Y, 2, 2, False);
WaitOption('pen', 500);
end;
end;
Wait(1000);
while IsMoving do
AntiBan;
Wait(750+Random(200));
until(Result or (Tries = 5))
if Result then
Writeln('Found and clicked door!')
else
begin
WriteLn('Failed to find door');
//Anything else you want it to do upon failing
end;
end; I also noticed it would keep repeated until it found the door, which it may not, so added it to break upon failing five times. If there's anything you don't understand about what I've done there, let me know :)
2012-04-21 16:54:44
2012-04-21 17:00:05