Results 1 to 15 of 15

Thread: Door check/open

  1. #1
    Join Date
    Sep 2006
    Posts
    5,219
    Mentioned
    4 Post(s)
    Quoted
    1 Post(s)

    Default Door check/open

    I've got a script walking from port phasmatys bank to furnace by click the furnace twice, this works fine unless some jerk closes the door. If the door is closed, the first click takes to right in front of the door, so I want to put a door procedure between the two furnace clicks.

    Whats the best way of doing this?

    I was thinking about starting in the middle because the door should be right in front of the char and then spiral out checking for door uptext, then checking whether its open or close and acting accordingly. However I seem to remember reading that spiral is detectable. Also, color seems to be out of the question because of too many false positives.

  2. #2
    Join Date
    Aug 2006
    Location
    London
    Posts
    2,021
    Mentioned
    2 Post(s)
    Quoted
    0 Post(s)

    Default

    i think a DTM would serve well here,
    i not then use a bitmap and use the function FindDeformed
    Join the Official SRL IRC channel. Learn how to Here.

  3. #3
    Join Date
    Feb 2006
    Location
    Amsterdam
    Posts
    13,692
    Mentioned
    146 Post(s)
    Quoted
    130 Post(s)

    Default

    I made something with Deformed Bitmaps. (only works for falador doors)

    SCAR Code:
    // ************************ //

    Function OpenDoor : Boolean;

    Var Dx,Dy,DoorClosed : Integer;
    Var Accuracy : Extended;

    Begin
    DoorClosed := BitmapFromString(2, 16, 'z78DA6DC6B10DC030080' +
           '4C09588F13F4F892D67FF9152A44924AEBA341987660095AE416F' +
           '0E4DA27908A43C1CFABD148CE64BC96A7EB4B9647181DF97E9703' +
           '71FBA79DE3F8E0D299B');
      FindDeformedBitmapToleranceIn(DoorClosed, Dx, Dy, 0, 0, 520, 340, 9, 4, True, Accuracy);
      WriteLn('Accuracy = '+FloatToStr(Accuracy));
      If Accuracy > 0.92 Then
        Begin
          MMouse(Dx,Dy+5,0,0);
          Wait(300);
          If (IsUpText('pen') Or IsUpText('oor')) Then
            Begin
              Result := True;
              GetMousePos(Dx,Dy);
              Mouse(Dx,Dy,0,0,True);
            End;
        End;
      FreeBitMap(DoorClosed);
    End;

    // ************************ //

    Function DoorIsOpen : Boolean;

    Var Dx,Dy,DoorOpen : Integer;
    Var Accuracy : Extended;

    Begin
    DoorOpen := BitmapFromString(19, 1, 'z78DAB330363736B5B0303' +
           '0373435C324CD5DCCDC4C4D49209DCC9C4D8DF093009A23194D');
        FindDeformedBitmapToleranceIn(DoorOpen, Dx, Dy, 0, 0, 520, 340, 9, 4, True, Accuracy);
        WriteLn('Accuracy = '+FloatToStr(Accuracy));
        If Accuracy < 0.85 Then
          Begin
            Result := True;
            WriteLn('The door is open.');
          End
        Else
          If OpenDoor Then Result := True;
    FreeBitMap(DoorOpen);
    End;

    ^ Forum did something to my indenting.

    Anyway, this works for me, I use at the house you enter to go down to the dwarven mines
    (North East house in Falador.)

    Correct use would be :

    SCAR Code:
    If DoorIsOpen Then
        Begin
        End;



    The best way to contact me is by email, which you can find on my website: http://wizzup.org
    I also get email notifications of private messages, though.

    Simba (on Twitter | Group on Villavu | Website | Stable/Unstable releases
    Documentation | Source | Simba Bug Tracker on Github and Villavu )


    My (Blog | Website)

  4. #4
    Join Date
    Sep 2006
    Posts
    5,219
    Mentioned
    4 Post(s)
    Quoted
    1 Post(s)

    Default

    Thanks for your help. I tried making dtms and bitmaps for those that work, but they either didn't work or lagged so much I never got to find out if they did. Then I tried mousing over different points and checking uptext but that is proving frustrating too. It either doesn't work or takes too long and looks suspicious. I'll take another crack at both ways after I go out, until then anyone have other methods (or bitmaps that work for the port or a good way to check uptext at points)?

  5. #5
    Join Date
    Aug 2006
    Location
    London
    Posts
    2,021
    Mentioned
    2 Post(s)
    Quoted
    0 Post(s)

    Default

    well i used DTMs in my draynor jail killer, it always find the door when its closes, maybe you should try some more with DTMs, the one for my door had the parent in the middle of the door, and 3 points on the top of the door, try to look for very differant colors, like i found that in the draynor door, there was a few pixels of purple

    or you could write your own version of wizzup?'s find door

    if not, use the function FindDeformed, i know it lags, but get a 2x2 bitmap and it should work

    it that doesnt work, copy the FindDeformed function and make some changed to it
    Join the Official SRL IRC channel. Learn how to Here.

  6. #6
    Join Date
    Sep 2006
    Posts
    5,219
    Mentioned
    4 Post(s)
    Quoted
    1 Post(s)

    Default

    I think part of the reason dtms and bitmaps aren't working is because the door is so thin. Anyway, I wrote a procedure that checks the uptext at random points in a box, and another one to get close to the door so that box doesn't have to be big. I tuned the box pretty well and it's finding the door fairly quickly. I ran it for a while and saw how it handled open and closed and it worked well. It did 9 steel bars in less than a minute, random clicking, some antiban, antirandom, and looks to others pretty human (although probably not if jagex is watching all mouse movements), so I'm happy. Again, thanks for your help.

  7. #7
    Join Date
    Oct 2006
    Posts
    412
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I use something like this.

    PHP Code:
    repeat
          FindColorTolerance
    (x,y,doorColor,6,3,510,337,2);//find the door color
          
    MMouse(x,y,1,1);//move the mouse and check what the upText is.
    until (IsUpText('oor'));//keep looking untill the door is found
    If (IsUpText('pen'))
    (
    Procedure for walking to the furnace)
    else if (
    IsUpText('los'))
    MouseFlag(x,y,1,1);//to click and open the door
    (Procedure for walking to the furnace

  8. #8
    Join Date
    Sep 2006
    Posts
    5,219
    Mentioned
    4 Post(s)
    Quoted
    1 Post(s)

    Default

    Here's what I ended up doing if anyone's interested.

    This finds the red (230-260 ish) that is closest to the furnace symbol (unless it's too close which means it's a drop, in theory if a drop is closer than the door but further than 'too close' it could screw up, although that hasn't happened so far, but I may add finddtmrotated or something to distinguish the door (red line) from drop (red circle)). Please excuse the messy code, it's based on my bank finder and I converted it quickly.
    SCAR Code:
    procedure findreds (var fx, fy:integer;    PointsToFind,width,basex,basey,endx,endy:integer);
    var
    box :array of ybox;
    ypoint : array of tehpointfur;
    x,d,e,f,i,g,rx,ry,tehcolor,lowest,lowestp,nob,{gx,gy,}currentpoint,row,prow,col,nor,noc:integer;//var
    //x,d,nob,gx,gy,currentpoint,row,prow,col,nor,noc:integer;

    begin

     repeat
          if not(Loggedin) then break;
          if(TimeFromMark(Mark)>600000) then begin Logout; Exit; end;
       Until(FindSymbol(rx,ry,'furnace'));

    noc:=(( (endx-basex) - (width mod (endx-basex)))/width)+1;
    nor:=(( (endy-basey) - (width mod (endy-basey)))/width)+1;
    //noc:=round( (endx-basex)/width );
    //nor:=round( (endy-basey)/width );

    nob:=nor*noc;
    setarraylength(box, ((nob)+2));
    repeat
      x:=x+1;
      if  ((x+noc) mod noc)>0 then
        col:=((x+noc) mod noc);
      if ((x+noc) mod noc) =0then
        col:=noc;
      prow:=0;
      repeat
        prow:=prow+1;
      until (  x<=(noc*prow));
      row:=prow;
      box[x].x1:=(basex+ ((col-1)*width) );
      box[x].x2:=(basex+(col*width));
      box[x].y1:=(basey+ ((row-1)*width) );
      box[x].y2:=(basey+(row*width));
      box[x].cx:=round((box[x].x2+box[x].x1)/2);
      box[x].cy:=round((box[x].y2+box[x].y1)/2);
      box[x].active:=true;

        {
      movemouse(box[x].x1,box[x].y1);
      holdmouse(box[x].x1,box[x].y1,true);
      movemouse(box[x].x2,box[x].y2);
      releasemouse(box[x].x2,box[x].y2,true);
         }



    until x>=nob;


    currentpoint:=1;
    d:=0;
    setarraylength(ypoint, pointstofind+1);
    repeat
      d:=d+1;
      if (box[d].active) then
      begin
        tehcolor:=210;
        repeat
        tehcolor:=tehcolor+1;
        //if findcolor(gx,gy,tehcolor,box[d].x1,box[d].y1,box[d].x2,box[d].y2) then
        until (findcolor(gx,gy,tehcolor,box[d].x1,box[d].y1,box[d].x2,box[d].y2) or (tehcolor>=260));
        if  (findcolor(gx,gy,tehcolor,box[d].x1,box[d].y1,box[d].x2,box[d].y2))then
        begin
          ypoint[currentpoint].x :=gx;
          ypoint[currentpoint].y :=gy;
          ypoint[currentpoint].dist:=Round(Sqrt(Sqr(ypoint[currentpoint].x - rx) + Sqr(ypoint[currentpoint].y- ry)))
          currentpoint:=currentpoint+1;
          box[d].active:=false;
        end;
     end;
    until ((  currentpoint= pointstofind)or (d=nob));

    e:=0;
    repeat
    e:=e+1;
    if (not(ypoint[e].x=0) and not(ypoint[e].y=0)) then
    ypoint[e].active:=true;
    if ypoint[e].dist<5 then
    ypoint[e].active:=false;
    until e=pointstofind;
    e:=0;
    lowest:=1000;
    repeat
    e:=e+1;
    if ypoint[e].active then
    begin
    if ypoint[e].dist<lowest then
    lowestp:=e;
    lowest:=min(lowest, ypoint[e].dist);
    end;
    until e=pointstofind;
    gx:=ypoint[lowestp].x;
    gy:=ypoint[lowestp].y;
    end;
    clicks the door, gets either the square right above or right below
    SCAR Code:
    Mouse(gx,gy,0,0,True);
    wait(2000+random(500));

    waits til you're not moving (countflag didn't work when the door closed after opening because the char stops at the door but doesn't get to the flag)
    SCAR Code:
    procedure waittilstill;
    var
    points: array [0..17] of tpoint;
    color: array [0..17] of integer;
    oldcolor: array [0..17] of integer;
    gh,hg,same: integer;

    begin
    points[1].x:=600
    points[1].y:=30
    points[2].x:=630
    points[2].y:=30
    points[3].x:=660
    points[3].y:=30
    points[4].x:=690
    points[4].y:=30
    points[5].x:=600
    points[5].y:=60
    points[6].x:=630
    points[6].y:=60
    points[7].x:=660
    points[7].y:=60
    points[8].x:=690
    points[8].y:=60
    points[9].x:=600
    points[9].y:=90
    points[10].x:=630
    points[10].y:=90
    points[11].x:=660
    points[11].y:=90
    points[12].x:=690
    points[12].y:=90
    points[13].x:=600
    points[13].y:=120
    points[14].x:=630
    points[14].y:=120
    points[15].x:=660
    points[15].y:=120
    points[0].x:=690
    points[0].y:=120
    gh:=17;
    repeat
    wait(50);
    gh:=gh+1;
    hg:=(gh mod 16);
    oldcolor[hg]:=color[hg];
    color[hg]:=getcolor(points[hg].x,points[hg].y);
    if (color[hg]=oldcolor[hg]) then same:=same+1;
    if not(color[hg]=oldcolor[hg]) then same:=0;
    until same>=10;
    end;

    looks in a fairly small area for door, and opens if needed (btw if a door is open, it says close door, and vice versa)
    SCAR Code:
    procedure datdoor;
    var cpoint:array [0..133] of tpoint;
    g,j,dx,dy:integer;
    begin
    j:=0;
    repeat
    j:=j+1;
    wait(10);
    mmouse(255+random(40),85+random(95),0,0)
    until ((IsUpTextMulti('Door','oor','oo')) or (j=100));
    if IsUpTextMulti('Open','pen','Ope') then
          begin
            GetMousePos(Dx, Dy);
            Mouse(Dx, Dy, 0, 0, False);
            if ChooseOption(Dx, Dy, 'pen')  then
          end;
    end;

    Then click furnace/bank symbol

  9. #9
    Join Date
    Feb 2006
    Location
    Amsterdam
    Posts
    6,136
    Mentioned
    28 Post(s)
    Quoted
    17 Post(s)

    Default

    How close are you from the door with your last scriptclick?
    If you end up very close to it, you might try considering tilting the view down, so the door becomes a huge object in the mainscreen. A simple mousemove and a uptext check should get you there.
    When I approach a door I always do the following.
    • I turn on Set Run.
    • I increase my mousespeed
    • I tilt down.
    • I move the mouse or perform some kind of fast objectcheck, like a bitmaptol or a multi ('Ope',pen','en)
    • When the door is closed I click it, and -as fast as I can- run through it (Click on Minimap).
    • I reset to default mouse and setrun.


    Time has prooven this to be the preffered method, but doors will always stay very tricky. Hope this helps.
    SRL is a Library of routines made by the SRL community written for the Program Simba.
    We produce Scripts for the game Runescape.

  10. #10
    Join Date
    Sep 2006
    Posts
    5,219
    Mentioned
    4 Post(s)
    Quoted
    1 Post(s)

    Default

    Quote Originally Posted by WT-Fakawi View Post
    How close are you from the door with your last scriptclick?
    If you end up very close to it, you might try considering tilting the view down, so the door becomes a huge object in the mainscreen. A simple mousemove and a uptext check should get you there.
    When I approach a door I always do the following.
    • I turn on Set Run.
    • I increase my mousespeed
    • I tilt down.
    • I move the mouse or perform some kind of fast objectcheck, like a bitmaptol or a multi ('Ope',pen','en)
    • When the door is closed I click it, and -as fast as I can- run through it (Click on Minimap).
    • I reset to default mouse and setrun.


    Time has prooven this to be the preffered method, but doors will always stay very tricky. Hope this helps.
    Findreds (see above) gets me as close as possible, either the square above or below the door (except for the possibilty of the aforementioned drop in just the 'right' place). Findreds gets me so close that after tilting down, I can pretty much guarantee where it's going to be if its closed, and wouldn't even need to find a bitmap etc. Also, if it's open, tilt down and compass east/west I also know where it will be. Yes this helps a lot. All I have to do is play with the compass and tilt stuff (never used em before except for face north), and find where the door will be. Changing the tilt and compass everytime I get to a door won't look as bad as moving the mouse to several different places like I have it know. Then the other thing I'll work on is making sure drops can't be mistken for doors on the minimap, if I can do that, getting to within 1 square of the door will be perfect. Best of all, this won't depend on colors/bitmaps/dtms, the ultimate auto color lol. Thanks again.

    By the way Fakawi, great job on the Draynor melter, I really like the deposit/withdraw stuff. I'm using it in port phasmatys because walking to lumby didn't work for me, and that's what this door thing is for.

  11. #11
    Join Date
    Feb 2006
    Location
    Amsterdam
    Posts
    6,136
    Mentioned
    28 Post(s)
    Quoted
    17 Post(s)

    Default

    I Memberized you, Boreas.
    You will find more valuable tools and scripts in the membersection

    Enjoy!

    Fawk.
    SRL is a Library of routines made by the SRL community written for the Program Simba.
    We produce Scripts for the game Runescape.

  12. #12
    Join Date
    Sep 2006
    Posts
    5,219
    Mentioned
    4 Post(s)
    Quoted
    1 Post(s)

    Default

    Wow thanks. *Goes off to check out member section*

  13. #13
    Join Date
    Nov 2006
    Posts
    16
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default 2 doors?

    Im trying to get to a fireplace and i have 2 doors in front of me but there are also 2 to the side how am i gonna get the script to click on the right doors any ideas? much appreciate any help

  14. #14
    Join Date
    Sep 2006
    Posts
    5,219
    Mentioned
    4 Post(s)
    Quoted
    1 Post(s)

    Default

    I think I have something that can help you. MSN: Boreas.srl@hotmail.com

  15. #15
    Join Date
    Jun 2006
    Posts
    250
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Try a FindObj command looking for the word open. If its not found, then the door must be open! Thats what I use anyway...

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Check if door is open
    By itSchRis917 in forum OSR Help
    Replies: 10
    Last Post: 05-26-2008, 04:15 AM
  2. find door and open
    By plaxlord in forum OSR Help
    Replies: 1
    Last Post: 03-28-2008, 04:39 AM
  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
  •