Results 1 to 9 of 9

Thread: DTM or FindChat?

  1. #1
    Join Date
    Jun 2007
    Posts
    532
    Mentioned
    1 Post(s)
    Quoted
    68 Post(s)

    Default DTM or FindChat?

    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.




  2. #2
    Join Date
    Feb 2006
    Location
    Tracy/Davis, California
    Posts
    12,631
    Mentioned
    135 Post(s)
    Quoted
    418 Post(s)

    Default

    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!

  3. #3
    Join Date
    Dec 2011
    Posts
    484
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Why not use all those methods for failsafes? You can never have too many failsafes.

  4. #4
    Join Date
    Jun 2007
    Posts
    532
    Mentioned
    1 Post(s)
    Quoted
    68 Post(s)

    Default

    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;

  5. #5
    Join Date
    Feb 2006
    Location
    Tracy/Davis, California
    Posts
    12,631
    Mentioned
    135 Post(s)
    Quoted
    418 Post(s)

    Default

    Not even the box one, just simply the one that searches one pixel for color will work fine!
    I think it's just GetColor

  6. #6
    Join Date
    Jun 2007
    Posts
    532
    Mentioned
    1 Post(s)
    Quoted
    68 Post(s)

    Default

    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.

  7. #7
    Join Date
    May 2007
    Location
    England
    Posts
    4,140
    Mentioned
    11 Post(s)
    Quoted
    266 Post(s)

    Default

    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 this
    Simba 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;
    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
    <3

    Quote Originally Posted by Eminem
    I don't care if you're black, white, straight, bisexual, gay, lesbian, short, tall, fat, skinny, rich or poor. If you're nice to me, I'll be nice to you. Simple as that.

  8. #8
    Join Date
    Jun 2007
    Posts
    532
    Mentioned
    1 Post(s)
    Quoted
    68 Post(s)

    Default

    That looks great! Mind if I use it? Credits of course and yeah I just noticed could be a endless loop.

  9. #9
    Join Date
    May 2007
    Location
    England
    Posts
    4,140
    Mentioned
    11 Post(s)
    Quoted
    266 Post(s)

    Default

    Feel free.
    <3

    Quote Originally Posted by Eminem
    I don't care if you're black, white, straight, bisexual, gay, lesbian, short, tall, fat, skinny, rich or poor. If you're nice to me, I'll be nice to you. Simple as that.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •