Results 1 to 6 of 6

Thread: Finding and opening doors

  1. #1
    Join Date
    Jun 2012
    Location
    Toronto, CA
    Posts
    24
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Finding and opening doors

    I've looked through tutorial island, and also Googled it of course :P, but I can't find anyone who explains how to find and open a door. My script is utilizing SPS walking if this makes a difference.

    Thanks,
    Mezz

  2. #2
    Join Date
    Feb 2012
    Location
    Somewhere, over the rainbow...
    Posts
    2,272
    Mentioned
    3 Post(s)
    Quoted
    45 Post(s)

    Default

    Open this in Simba

    Simba\Includes\SRL\srl\misc\doorprofiles

    See if that helps

  3. #3
    Join Date
    Dec 2011
    Location
    Behind you...
    Posts
    345
    Mentioned
    0 Post(s)
    Quoted
    4 Post(s)

    Default

    Ive also had a problem with this, in the end i just gave up ;_;
    Scripting powerlevel = [||||||||]

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

    Default

    Try something like this maybe.

    It finds the door handle color for the door to Maggies house. You can write your own opening procedure.

    Simba Code:
    Function DoorFinder(var x, y: Integer): Boolean;
    Var
      CTS, I: Integer;
      DoorTPA: TPointArray;
      ATPA: Array of TPointArray;
    Begin
    If(Not(LoggedIn))Then Exit;
    CTS := GetColorToleranceSpeed;
    ColorToleranceSpeed(2);
    SetColorSpeed2Modifiers(0.84, 0.16);
    FindColorsSpiralTolerance(MSCX, MSCY, DoorTPA, 3486513, MSX1, MSY1, MSX2, MSY2, 10);
    ATPA := TPAToATPAEx(DoorTPA, 3, 3);


      For I := 0 To High(ATPA) Do
      Begin
        MiddleTPAEx(ATPA[i], x, y);
        MMouse(x, y, 2, 2);
        If(IsUpTextMultiCustom(['pen','oor'])) Then
        Begin
          Writeln('Found Door');
          GetMousePos(x, y);
          Result := True;
          Break;
        End;
      End;
    End;
    Finished B.S. Program in Radiology!!

    Projects: A big one! Total secret! hehe

  5. #5
    Join Date
    Jan 2008
    Location
    C:\
    Posts
    1,483
    Mentioned
    2 Post(s)
    Quoted
    2 Post(s)

    Default

    Just to give you an alternative to the way 14578 has posted, this one will find the door color and make a big ATPA out of it:

    Simba Code:
    function FindDoor(Color, Tol, Min: Integer; Open: Boolean): Boolean;
    var
      ATPA: T2DPointArray;
      TPA: TPointArray;
      P: TPoint;
      hATPA, i: Integer;
    begin
      Result := False;
      FindColorsTolerance(TPA, Color, MSX1, MSY1, MSX2, MSY2, Tol);
      if (Length(TPA) > Min) then
      begin
        ATPA := SplitTPAEx(TPA, 10, 20);
        hATPA := High(ATPA);
        for i := 0 to hATPA do
        begin
          P := MiddleTPA(ATPA[i]);
          Mouse(P.x, P.y, 3, 3, mouse_move);
          if WaitUptextMulti(['doo', 'oor'], 500) then
          begin
            if WaitUptext('pen', 250) then
            begin
              if Open then
              begin
                ClickMouse2(mouse_left);
                while IsMoving do
                  Wait(500);
              end;
              Result := True;
              Exit;
            end else
            begin
              if not Open then
              begin
                ClickMouse2(mouse_left);
                while IsMoving do
                  Wait(500);
              end;
              Result := True;
              Exit;
            end;
          end;
        end;
      end;
    end;

    I suggestion using it with vars something like this:

    Simba Code:
    if FindDoor(DoorColor, 5, 40, True) then
    begin
      // ...
    end;

    I don't know why you'd ever need to find a door and close it, but hey I like to plan for everything

  6. #6
    Join Date
    Jun 2012
    Location
    Toronto, CA
    Posts
    24
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Thank you for the help guys, I'll definitely try and utilize that function (or a similar one ) in a script. I spent a while trying to figure out how to use the functions in DoorProfiles Abu, and it seemed like the right tools for the job, I just didn't know quite what to do with them, so I took the easy way out and used a simple FindObjTPA. If someone has any pointers on using the functions in DoorProfile that would be amazing.

    Thanks again,
    Mezzanine

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
  •