Results 1 to 11 of 11

Thread: Check if door is open

  1. #1
    Join Date
    Jan 2007
    Location
    Illinois.. >.<
    Posts
    1,158
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Check if door is open

    All righty, i need some help here.. I want to check if a door is open WITHOUT moving the mouse and checking the uptext. That is the key right there. Here's a picture:



    I want to be able to find if that door is open without moving to it.. I've tried a DTM, didnt work.. Tried a basic bitmap. Didnt work. Tried DeformedBitmapToleranceIn. Didnt work. I'm not sure if i did that last one right though cause i have no experience with those.. But that's what I've tried so far. Can anyone help me out?

    Sorry i didnt specify which door.. But i think it's pretty obvious.. Its the only door that is open in the picture..

  2. #2
    Join Date
    Oct 2006
    Location
    Ontario,Canada
    Posts
    1,718
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    if its open the door has way more pixels of that color than when closed. the door also changes colors(open bright, closed dark) so you could really just check if that bright brown is in that area and then do a check on how many pixels there are.

  3. #3
    Join Date
    Jul 2007
    Location
    Massachusetts
    Posts
    896
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I have know idea, but a more human way to do it would be to have the script click outside the building and see if a flag appears where it clicked. If it did, the door is open, if not it is closed.

  4. #4
    Join Date
    Jan 2008
    Location
    Stanford, CA
    Posts
    329
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    ya, ive noticed that canada. but y dont u wanna check the uptext? is it different if its closed then open? but even still u probably should use uptext as a failsafe

  5. #5
    Join Date
    Oct 2006
    Location
    Ontario,Canada
    Posts
    1,718
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by freakymonkey View Post
    ya, ive noticed that canada. but y dont u wanna check the uptext? is it different if its closed then open? but even still u probably should use uptext as a failsafe
    he doesnt want to check the door because really what human checks what the uptext is?

  6. #6
    Join Date
    Jul 2007
    Location
    Massachusetts
    Posts
    896
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by XcanadamanX View Post
    he doesnt want to check the door because really what human checks what the uptext is?
    I do (JK)

    But some humans do forget to check if the door is open, which makes my way work

  7. #7
    Join Date
    Jan 2008
    Location
    Stanford, CA
    Posts
    329
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    well, just because the mouse is hovering over the door isnt always a sheer giveaway that the person is checking the uptext right? if he wants he can randomize the frequency the character checks the uptext he can. it was merely a suggestion, but your way would work well nonetheless canada

  8. #8
    Join Date
    Jan 2007
    Location
    Illinois.. >.<
    Posts
    1,158
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Nice idea Macrosoft, i do that all the time. Lol. But i think canada's idea is the best. I'll try that and edit/post back.

    EDIT: I'm going to use Macrosoft's idea.. There are too many colors similar to the door...

  9. #9
    Join Date
    Jul 2007
    Location
    Massachusetts
    Posts
    896
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    YAY! I contributed!

    Yeah, I think my idea is more reliable.

  10. #10
    Join Date
    Jan 2008
    Location
    Stanford, CA
    Posts
    329
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Quote Originally Posted by itschris917 View Post
    EDIT: I'm going to use Macrosoft's idea.. There are too many colors similar to the door...
    thats y u use uptexts XD. haha, but i doubt there are that many colors (of the similar color of the door) concentrated in one area like the door. u could create a T2Dpointarray by distance and loop through each TPA?

  11. #11
    Join Date
    Jan 2007
    Location
    Illinois.. >.<
    Posts
    1,158
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Freakymonkey, look at the picture.. Compare(visually) the colors of the door to the colors of the floor.. It's a pain in the ass.. I could do the T2DPointArray as well.. but the problem is, i want to be standing exactly where i am in the picture, and if i did it by distance from the center or even the top left hand corner, it would find dozens of areas before the door. Im going with Macrosoft's idea...

    Here's what i have so far, i haven't actually tested it, but it should work in theory...

    SCAR Code:
    {------------------------------------------------------------------------------]
    [ function AutoColorCookeryFloor: Integer;                                     ]
    [ by: Itschris917                                                              ]
    [ Description: Returns current color of cookery floor.                         ]
    {------------------------------------------------------------------------------}

    function AutoColorCookeryFloor: Integer;
    var
      R,G,B : Integer;
      H,S,L : Extended;
      X,Y,Z : Extended;
      MyColor, TestColor : Integer;
      TPA : TPointArray;
      C1 : TIntegerArray;
      i, C2 : Integer;
    begin
      MyColor := 3098460;
      FindColorsSpiralTolerance(MMCX, MMCY, TPA, MyColor, MMX1, MMY1, MMX2, MMY2, 60);
      C1 := GetColors(TPA);
      C2 := Length(C1) -1;
      for i := 0 to C2 do
        begin
          if RS_OnMinimap(TPA[i].X, TPA[i].Y) then
          begin
            TestColor := GetColor(TPA[i].X, TPA[i].Y);
            begin
               ColorToRGB(TestColor, R, G, B);
               ColorToHSL(TestColor, H, S, L);
               ColorToXYZ(TestColor, X, Y, Z);
               if InRange(R - G, 1, 41) then
                 if InRange(R - B, 25, 65) then
                   if InRange(G - B, 4, 44) then
                     if InRange(Round(S) - Round(H), 8, 38) then
                       if InRange(Round(L) - Round(H), 3, 33) then
                         if InRange(Round(S) - Round(L), -10, 20) then
                           if InRange(Round(X) - Round(Y), -7, 7) then
                             if InRange(Round(Y) - Round(Z), -4, 10) then
                               if GetColor(TPA[i].X + 2, TPA[i].Y + 2) = TestColor then
                                 if GetColor(TPA[i].X + 1, TPA[i].Y + 1) = TestColor then
                                 begin
                                   Writeln('MyColor = '+Inttostr(TestColor));
                                   Result := TestColor;
                                   Exit;
                                 end;
          end;
        end;
      end;
      Writeln('Couldnt find My Color!');
      Result := 0;
    end;

    {------------------------------------------------------------------------------]
    [ function CheckIfWeLeft: Boolean;                                             ]
    [ by: Itschris917                                                              ]
    [ Description: Checks if the player left the cooking house.                    ]
    {------------------------------------------------------------------------------}

    function CheckIfWeLeft:Boolean;
    begin
      x := MMCX;
      y := MMCY - 4;
      Result := GetColor(x, y) = AutoColorCookeryFloor;
      if Result then
      begin
        Writeln('We have not left. Open the door.');
        //open door.
      end else

      Writeln('We have left. Door was open.');
    end;

    {------------------------------------------------------------------------------]
    [ procedure ToBank;                                                            ]
    [ by: Itschris917                                                              ]
    [ Description: Walks player back to bank.                                      ]
    {------------------------------------------------------------------------------}

    procedure ToBank;
    var
     rx, ry: Integer;
     angle: Extended;
    begin
      if not LoggedIn then Exit;
      if FindSymbol(rx, ry, 'bank') then
      begin
        MFNF(rx, ry, 4, 4);
        while FlagPresent do
          Randoms;
        CheckIfWeLeft;
        Players[CurrentPlayer].Loc:= 'Bank';
        MakeCompass('N');
      end
      else
        if FindDTMRotated(VEB,x,y,MMX1,MMY1,MMX2,MMY2,-1.0,2.0,0.5,angle) then
        begin
          MFNF(x + 3, y - 5, 2, 2);
          while FlagPresent do
            Randoms;
          CheckIfWeLeft;
          Players[CurrentPlayer].Loc:= 'Bank';
          MakeCompass('N');
        end;
    end;

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. find door and open
    By plaxlord in forum OSR Help
    Replies: 1
    Last Post: 03-28-2008, 04:39 AM
  2. Door check/open
    By Boreas in forum OSR Help
    Replies: 14
    Last Post: 11-25-2006, 11:30 PM
  3. how to open a door only if its closed?
    By XcanadamanX in forum OSR Help
    Replies: 9
    Last Post: 11-10-2006, 11:38 PM

Posting Permissions

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