Results 1 to 14 of 14

Thread: Help finding objects like doors and stairs

  1. #1
    Join Date
    Jun 2013
    Posts
    49
    Mentioned
    0 Post(s)
    Quoted
    23 Post(s)

    Default Help finding objects like doors and stairs

    Hello! So my script is coming along very well! I got my initial setup of what I'm doing working, my banking working, and my walking working. Along with those I have to climb up two stairs and open a door to continue to the bank.
    Right now I'm using this to find the door:
    Simba Code:
    Procedure OpenDoor1;
    begin
    MakeCompass('N');
    SetAngle(SRL_ANGLE_HIGH);

    If FindObjCustom(x, y, ['pen'], [2012657], 2) then
      begin
      Wait(randomRange(100, 250));
      ClickMouse2(Mouse_Left);
      If DidRedclick then
      Wait(RandomRange(3000, 4000));
      exit end else exit;
    end;
    Though this works, it doesn't always pick up the door so it will skip to the next step and mess up the whole script.
    So I considered using R_OpenDoor(Point(265, 205), 'S'); and I'm not sure if I have this typed 100% correctly or if it's just not working on a large door but it didn't even attempt to find the door.
    Now for the stairs, this seems to always work. But I would like something a bit more reliable.
    Here's how I'm finding the stairs:
    Simba Code:
    Procedure FindStairs1;
    begin
    MakeCompass('N');
    SetAngle(SRL_ANGLE_HIGH);

    If FindObjCustom(x, y, ['-up'], [5261641], 2) then
      begin
      Wait(randomRange(100, 250));
      ClickMouse2(Mouse_Left);
      If DidRedclick then
      Wait(RandomRange(3000, 4000));
      exit end else exit;
    end;

    Well that's that! I'm wondering if anyone would suggest the best option for me to finding the doors and the stairs and maybe something to setup to where it will keep trying to find it and complete the task before moving on? Thanks in advance!

  2. #2
    Join Date
    Aug 2007
    Posts
    539
    Mentioned
    20 Post(s)
    Quoted
    266 Post(s)

    Default

    Well it appears you are available to using reflection, so what I do for doors is that I check if 'R_GetObjectAt(3, closedDoorObjectTile).ID' doesn't equal 0. Meaning that the door is closed and needs to be opened. Then I use R_OpenDoor(closedDoorObjectTile, whichDirectionDoorIsToTile); to open the door.

    For extra failsafes I check if the player is within the area of which the door encompasses, and checks if needing to open the door is even needed.

    Also, it sounds like you are going up and down stairs, so you should check to see what 'plane' you are on with R_GetPlane, to make sure you are on the right plane.

  3. #3
    Join Date
    Jun 2013
    Posts
    49
    Mentioned
    0 Post(s)
    Quoted
    23 Post(s)

    Default

    Quote Originally Posted by ineedbot View Post
    Well it appears you are available to using reflection, so what I do for doors is that I check if 'R_GetObjectAt(3, closedDoorObjectTile).ID' doesn't equal 0. Meaning that the door is closed and needs to be opened. Then I use R_OpenDoor(closedDoorObjectTile, whichDirectionDoorIsToTile); to open the door.

    For extra failsafes I check if the player is within the area of which the door encompasses, and checks if needing to open the door is even needed.

    Also, it sounds like you are going up and down stairs, so you should check to see what 'plane' you are on with R_GetPlane, to make sure you are on the right plane.
    Now looking at that, I would think it would work. But with my little lack of knowledge for reflection on this certain thing. I need a bit more help if your willing. I looked into R_GetPlane and how it checks out which level your on. For my script I'm 2 underground and then the door is on normal ground which would be plane 0? I'm wondering how would I set this up to work?
    Also if you will, explain how to find the closedDoorObjectTile and whichDirectionDoorIsToTile.
    Like how do I know rather to put N or S? Is it by which direction the door opens up to or what?
    Here's a few pics of the stairs and the door if it helps any:
    example.jpg

  4. #4
    Join Date
    Jun 2013
    Posts
    49
    Mentioned
    0 Post(s)
    Quoted
    23 Post(s)

    Default

    Or if you could throw a script my way that uses these, I can go in and tweak it so I can learn how to set this up by myself?

  5. #5
    Join Date
    Aug 2007
    Posts
    539
    Mentioned
    20 Post(s)
    Quoted
    266 Post(s)

    Default

    Quote Originally Posted by Success View Post
    Now looking at that, I would think it would work. But with my little lack of knowledge for reflection on this certain thing. I need a bit more help if your willing. I looked into R_GetPlane and how it checks out which level your on. For my script I'm 2 underground and then the door is on normal ground which would be plane 0? I'm wondering how would I set this up to work?
    Also if you will, explain how to find the closedDoorObjectTile and whichDirectionDoorIsToTile.
    Like how do I know rather to put N or S? Is it by which direction the door opens up to or what?
    Here's a few pics of the stairs and the door if it helps any:
    example.jpg
    How I check to find the closed door tile, I use the ID Display.simba found in includes/srl-osr/srl/reflection/tools and close the door and find where the ID is (make sure you have debugObjects on true and debugObjectType on 3.)
    example:

    so in this case, the closed door tile is 2899, 3558, and the door is 'n' of the tile.

    Quote Originally Posted by Success View Post
    Or if you could throw a script my way that uses these, I can go in and tweak it so I can learn how to set this up by myself?
    My AIO Woodcutter uses opening doors for lumbridge oaks and edgeville yews. you can have a look at that

  6. #6
    Join Date
    Jun 2013
    Posts
    49
    Mentioned
    0 Post(s)
    Quoted
    23 Post(s)

    Default

    Quote Originally Posted by ineedbot View Post
    How I check to find the closed door tile, I use the ID Display.simba found in includes/srl-osr/srl/reflection/tools and close the door and find where the ID is (make sure you have debugObjects on true and debugObjectType on 3.)
    example:

    so in this case, the closed door tile is 2899, 3558, and the door is 'n' of the tile.



    My AIO Woodcutter uses opening doors for lumbridge oaks and edgeville yews. you can have a look at that
    God that's perfect! I didn't even know there was this tool.
    Thanks man! Wish me luck with this script and future ones, I plan on learning to script better over the next year

  7. #7
    Join Date
    Jun 2013
    Posts
    49
    Mentioned
    0 Post(s)
    Quoted
    23 Post(s)

    Default

    Oh and one last thing. How do you make debugObjects on true and debugObjectType on 3?
    I looked at your woodcutter around for these and didn't see them. Like would I need to set this up in my script?
    Or are you just talking about while I use the tool?

  8. #8
    Join Date
    Aug 2007
    Posts
    539
    Mentioned
    20 Post(s)
    Quoted
    266 Post(s)

    Default

    Quote Originally Posted by Success View Post
    Oh and one last thing. How do you make debugObjects on true and debugObjectType on 3?
    I looked at your woodcutter around for these and didn't see them
    Thats on the ID Display.simba script. Makes it so you can change what type of objects you want to debug.

  9. #9
    Join Date
    Aug 2007
    Location
    Colorado
    Posts
    7,421
    Mentioned
    268 Post(s)
    Quoted
    1442 Post(s)

    Default

    Agh, why rely on Reflection for something as simple as object-finding?...

    function openTheDoor()
    Simba Code:
    Function openTheDoor(): Boolean;
    var
      i : Integer;
    begin
      MakeCompass('N');
      SetAngle(SRL_ANGLE_HIGH);

      for i:=0 to 2 do
        If findObjCustom(x, y, ['pen'], [2012657], 2) then
        begin
          Wait(randomRange(100, 250));
          clickMouse2(Mouse_Left);
          result := didRedclick;

          if result then
            Wait(RandomRange(3000, 4000));
          break;
        end;

      case result of
        True : Writeln('Found & clicked the door!');
        False: Writeln('Failed to find the door.');
      end;
    end;
    function climbTheStairs()
    Simba Code:
    Function climbTheStairs(): Boolean;
    var
      i : Integer;
    begin
      MakeCompass('N');
      SetAngle(SRL_ANGLE_HIGH);

      for i:=0 to 2 do
        If findObjCustom(x, y, ['-up'], [5261641], 2) then
        begin
          Wait(randomRange(100, 250));
          clickMouse2(Mouse_Left);
          result := didRedclick;

          if result then
            Wait(RandomRange(3000, 4000));
          break;
        end;

      case result of
        True : Writeln('Found & clicked the stairs!');
        False: Writeln('Failed to find the stairs.');
      end;
    end;

    Come on you guys, use color for the easy stuff and use reflection as a last resort.

    Current projects:
    [ AeroGuardians (GotR minigame), Motherlode Miner, Blast furnace ]

    "I won't fall in your gravity. Open your eyes,
    you're the Earth and I'm the sky..."


  10. #10
    Join Date
    Jun 2007
    Location
    The land of the long white cloud.
    Posts
    3,702
    Mentioned
    261 Post(s)
    Quoted
    2006 Post(s)

    Default

    Quote Originally Posted by Flight View Post
    Agh, why rely on Reflection for something as simple as object-finding?...

    function openTheDoor()
    Simba Code:
    Function openTheDoor(): Boolean;
    var
      i : Integer;
    begin
      MakeCompass('N');
      SetAngle(SRL_ANGLE_HIGH);

      for i:=0 to 2 do
        If findObjCustom(x, y, ['pen'], [2012657], 2) then
        begin
          Wait(randomRange(100, 250));
          clickMouse2(Mouse_Left);
          result := didRedclick;

          if result then
            Wait(RandomRange(3000, 4000));
          break;
        end;

      case result of
        True : Writeln('Found & clicked the door!');
        False: Writeln('Failed to find the door.');
      end;
    end;
    function climbTheStairs()
    Simba Code:
    Function climbTheStairs(): Boolean;
    var
      i : Integer;
    begin
      MakeCompass('N');
      SetAngle(SRL_ANGLE_HIGH);

      for i:=0 to 2 do
        If findObjCustom(x, y, ['-up'], [5261641], 2) then
        begin
          Wait(randomRange(100, 250));
          clickMouse2(Mouse_Left);
          result := didRedclick;

          if result then
            Wait(RandomRange(3000, 4000));
          break;
        end;

      case result of
        True : Writeln('Found & clicked the stairs!');
        False: Writeln('Failed to find the stairs.');
      end;
    end;

    Come on you guys, use color for the easy stuff and use reflection as a last resort.
    It's a bit botty to check the upText though, and sometimes it can be really hard to grab a unique colour that works at all distances/compass angles.

    In my scripts I usually find the door relative to other objects, which are easy to find. In this example I find the Potters Wheel, and then create a Tbox which is offset from the middle of the potters wheel TPA. The great thing is, it works at any angle (if you take compass angle into account) and at any distance from the door (by taking the distance from the playerPoint to potters wheel TPA into account). This way it's pretty human like.






    TPA length < 250 = closed:


  11. #11
    Join Date
    Aug 2007
    Location
    Colorado
    Posts
    7,421
    Mentioned
    268 Post(s)
    Quoted
    1442 Post(s)

    Default

    Quote Originally Posted by The Mayor View Post
    It's a bit botty to check the upText though, and sometimes it can be really hard to grab a unique colour that works at all distances/compass angles.
    You should have read his post first. He has no problem finding the door/stairs, he's simply asking advice on how to repeat the procedure until they are clicked, AKA creating a loop within the procedure.

    Current projects:
    [ AeroGuardians (GotR minigame), Motherlode Miner, Blast furnace ]

    "I won't fall in your gravity. Open your eyes,
    you're the Earth and I'm the sky..."


  12. #12
    Join Date
    Jun 2007
    Location
    The land of the long white cloud.
    Posts
    3,702
    Mentioned
    261 Post(s)
    Quoted
    2006 Post(s)

    Default

    Quote Originally Posted by Flight View Post
    You should have read his post first. He has no problem finding the door/stairs, he's simply asking advice on how to repeat the procedure until they are clicked, AKA creating a loop within the procedure.
    I did read it When he said this:

    Quote Originally Posted by Success View Post
    it doesn't always pick up the door
    It sounded like he had trouble finding the door. And when he said:

    Quote Originally Posted by Success View Post
    I'm wondering if anyone would suggest the best option for me to finding the doors
    It sounded like he wanted people to suggest ways of finding doors. I just thought he might find it useful.

  13. #13
    Join Date
    Aug 2009
    Location
    Nova Scotia, Canada
    Posts
    604
    Mentioned
    0 Post(s)
    Quoted
    56 Post(s)

    Default

    Quote Originally Posted by The Mayor View Post
    In my scripts I usually find the door relative to other objects, which are easy to find. In this example I find the Potters Wheel, and then create a Tbox which is offset from the middle of the potters wheel TPA. The great thing is, it works at any angle (if you take compass angle into account) and at any distance from the door (by taking the distance from the playerPoint to potters wheel TPA into account). This way it's pretty human like.
    Bit of a grave-dig but would you mind sharing your code for figuring out the relative search box?
    Never ever approach a computer saying or even thinking "I will just do this quickly".

  14. #14
    Join Date
    Jun 2007
    Location
    The land of the long white cloud.
    Posts
    3,702
    Mentioned
    261 Post(s)
    Quoted
    2006 Post(s)

    Default

    Quote Originally Posted by Bixby Sayz View Post
    Bit of a grave-dig but would you mind sharing your code for figuring out the relative search box?
    I can dig out the code if you want, but have a look at Camel's tutorial first

Thread Information

Users Browsing this Thread

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

Tags for this Thread

Posting Permissions

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