Results 1 to 5 of 5

Thread: MMToMS Open Door Procedure

  1. #1
    Join Date
    Jun 2012
    Posts
    219
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default MMToMS Open Door Procedure

    Hi

    I have this procedure to open doors, I look for a specific DTM on the minimap and then try to transfer the coordinates to the main screen. The problem is that I can`t use the door on the minimap itself,I need to make a DTM that is right in front of the door as the symbol moves over the minimap door and then it does not find the DTM, so I made a dtm right in front of this door that never changes, It sometimes works and other times it messes up quite bad.

    I would appreciate some help and suggestions here.

    Here is the code and it is at the shop at Port Sarim

    Simba Code:
    procedure OpenDoor;
    VAR
      DPoint:Tpoint;
      aFound:Extended;
      XCount:Integer;
    begin
      ClickNorth(SRL_ANGLE_HIGH);
      ClosedDoor:= DTMFromString('mbQAAAHicY2VgYBADYlEgFgZiaSgGsVUZIABEswCxtZUZQ16iMkNSjDZDpJMMGBsBxbnQMCMWDAYAOXoFLg==');
      WriteLn('Search For The Door');
    //  While not(IsUpText('oor')) do
    //  Begin
        WriteLn('Beginning To Search For The Door In The MiniMap');
        if FindDTMRotated(ClosedDoor, x, y, MMX1, MMY1, MMX2, MMY2, -Pi/4, Pi/4, Pi/60, aFound) then
        Begin
          WriteLn('We Have Found The Door');
          DPoint := MMToMS(Point(x,y));
          XCount := 15;
          Repeat
            Inc(XCount);
            MMouse(DPoint.x-XCount, DPoint.y,0,0);
            x:=DPoint.x-XCount;
            y:=DPoint.y+XCount;
    //        MMouse(DPoint.x-30, DPoint.y,0,0);
            If (XCount > 50) then
            Begin
              Break;
            End;
          Until IsUpText('pen'); // or (XCount > 35);
            If IsUpText('pen') then
            Begin
              ClickMouse2(mouse_right);
    //          Mouse(x, y, 0, 0, mouse_right);
              Wait(RandomRange(480,530));
              ChooseOption('pen');
              Writeln('Opening door');
              Wait(RandomRange(1500,1600));
            end else
            Begin
              Writeln('The Door Is Already Opened.');
            End;
        End;
    //  End;
      FreeDTM(ClosedDoor);
    end;

  2. #2
    Join Date
    Mar 2012
    Location
    127.0.0.1
    Posts
    3,383
    Mentioned
    95 Post(s)
    Quoted
    717 Post(s)

    Default

    MMToMS is a little bit off. Have you tried another walking method to the door, then checking if it's open manually? If you want to do it that way, you could get which way the red line faces, and then make a box, and count the colors in the box. If the colors are over a certain amount, then the door is closed, and if they're not, it's open. Here, let me explain a bit.


    Say this was the door on the minimap: ----------
    You would make a box around it, and then check the colors, and get an average amount. Then when the door opens, there isn't as much red in the box, so the door is open.

  3. #3
    Join Date
    Jun 2012
    Posts
    219
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    The Door is between 25 - 35 pixels of from the dtm. that is why I use a counter to increase the x axis until I get the Uptext for the door, so is it possible to make a box say 50 pixels around the the tpoint and just search for the uptext for the door in that box. I don`t quite understand intobox so well. How do I search with that command just in that box that was created?

    I think that would be the easiest way to do the search as I don`t want to turn and face the door before I check for it.

    But if I could use the intobox just to search in that box I will find the door and can use the uptext to open or close it.

    For instance if I use this

    Simba Code:
    if FindDTM(DBox, x, y, MSX1, MSY1, MSX2, MSY2) then
        Box := IntToBox(x - 50, y - 50, x + 50, y + 50);
    end;

    How do I tell it to search just inside the box that was created?

  4. #4
    Join Date
    Mar 2012
    Location
    127.0.0.1
    Posts
    3,383
    Mentioned
    95 Post(s)
    Quoted
    717 Post(s)

    Default

    FindDTM(DBox,x,y,BOXHERE.x1,BOXHERE.y1,BOXHERE.x2, BOXHERE.y2)

  5. #5
    Join Date
    Jun 2012
    Posts
    219
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Ahh, Thanks very much Now it all will work.

    Edit. Ok, I have implemented the suggestion.It works, but I have One Problem. It creates a box around the player and not around the object I have found, and that sorts of defeat the purpose of the box around the dtm it have found.

    I have two questions. One, how do I draw the box it creates on the canvas so that I can see where it has found the box and where it is supposed to search in?

    Two, How do I force it to search from the middle of the box it has created and not from me?

    Here is the current code.

    Simba Code:
    procedure OpenDoor;
    var
      DPoint:Tpoint;
      aFound:Extended;
      x, y, ClosedDoor,Door:Integer;
      Box:TBox;
    Begin
      ClickNorth(SRL_ANGLE_HIGH);
      Door := DTMFromString('mQwAAAHicY2ZgYPgMxJ+A+CMQHwDidUB8GYjT46wY/n67DcZcQD4rFDMiYSAAAO3kC80=');
      ClosedDoor:= DTMFromString('mbQAAAHicY2VgYBADYlEgFgZiaSgGsVUZIABEswCxtZUZQ16iMkNSjDZDpJMMGBsBxbnQMCMWDAYAOXoFLg==');
      WriteLn('Search For The Door');
      WriteLn('Beginning To Search For The Door In The MiniMap');
      If FindDTMRotated(ClosedDoor, x, y, MMX1, MMY1, MMX2, MMY2, -Pi/4, Pi/4, Pi/60, aFound) then
      Begin
        WriteLn('Outside DTM Found');
        DPoint := MMToMS(Point(x,y));
        MMouse(DPoint.x,DPoint.y,0,0);
        Box := IntToBox(DPoint.x - 100, DPoint.y - 100, DPoint.x + 100, DPoint.y + 100);
        If FindDTMRotated(Door, x, y, Box.X1, Box.Y1, Box.X2, Box.Y2, -Pi/4, Pi/4, Pi/60, aFound) then
        Begin
          WriteLn('Searching For The Door In The Box');
          If (FindObjCustom(x, y, ['pen Do', 'Do'], [{AutoColorDoor,}403503, 4023404, 2507337, 5726053, 8420363], 15)) then
          begin
            WriteLn(GetUpText);
            ClickMouse2(mouse_right);
            Wait(RandomRange(480, 530));
            ChooseOption('pen');
            Writeln('Opening door');
            Wait(RandomRange(1500, 1600));
          end else
          Begin
            WriteLn(GetUpText);
            Writeln('The Door Is Already Opened.');
          End;
        end else
          Writeln('The Door Is Already Opened.');
        End;
      FreeDTM(ClosedDoor);
      FreeDTM(Door);
    End;
    Last edited by VastlySuperior; 08-15-2012 at 06:18 AM. Reason: Need some clarification and further help.

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
  •