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.
![]()
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.
![]()
I use GetColor to finding chat like that. (Or I think FindColor?)
Just check a specific pixel for the black color and you should be just fine.
Fast, Simple, Easy!
Why not use all those methods for failsafes? You can never have too many failsafes.
Something like this?
Simba Code: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;
Not even the box one, just simply the one that searches one pixel for color will work fine!
I think it's just GetColor
Thank YoHoJo. Always helpful!
This is what I have so far
Simba Code: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;
But is this this one better? *Flight did not make this one for me its from another script on here and I am not using it and if I choose to I will ask Flight for permission.*
Simba Code: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;
Last edited by Element17; 04-21-2012 at 03:54 PM.
As for the first piece of code above, I'd suggest search for one specific pixel (or two to be sure) instead of the entire chat box, as there could be other reasons why black would be there. It could also be made easier by making it a function, instead of a procedure, like thisI 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 knowSimba Code: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;![]()
<3
Originally Posted by Eminem
That looks great! Mind if I use it? Credits of course and yeah I just noticed could be a endless loop.
Feel free.
<3
Originally Posted by Eminem
There are currently 1 users browsing this thread. (0 members and 1 guests)