1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Open and close gate?

Discussion in 'Projects' started by mrpiccard, Mar 23, 2015.

  1. mrpiccard

    Joined:
    Mar 20, 2015
    Messages:
    3
    Likes Received:
    2
    Hey guys! This is my first forum post so if it's in the wrong section please move it or let me know.

    I'm working on my first bot, and one thing I'm stuck on is gates. How do I check if its open or closed? Or is there a standard way of dealing with walking past open/closed gates?
     
  2. Exia

    Joined:
    Nov 3, 2013
    Messages:
    609
    Likes Received:
    259
    You have a couple of options:
    1) You'll need to grab the tile location. It should be different when the door/gate is opened/closed.
    2) If the location doesn't change, then try the actual model ID, that should be different.
    3) If those can't tell the difference, then try looking at the value of getOrientation() on the gameobject.

    Hope this helps.
     
  3. Arbiter

    Arbiter Mod Automation

    Joined:
    Jul 26, 2013
    Messages:
    2,937
    Likes Received:
    1,266
    To answer your question there is in fact a standard way to deal with doors and other such navigation related items, but it involves adding to the web walking implementation. That is an advanced topic for a beginner, but I know a lot of our great devs would be happy to explain it to you in our Skype dev chat. PM me your Skype if you're interested.
     
  4. mrpiccard

    Joined:
    Mar 20, 2015
    Messages:
    3
    Likes Received:
    2
    thank you! i actually just realized the ID is different
     
  5. Ozzy

    Joined:
    Nov 5, 2014
    Messages:
    505
    Likes Received:
    162
    Another way would be to run a query to find nearby closed gates. (Adjust the query to search within a certain area/distance of you)

    Code (Text):
    1. LocatableEntityQueryResults<GameObject> closedGates = GameObjects.newQuery().names("Gate").actions("Open");
    You can then do something like:

    Code (Text):
    1. if (!closedGates.isEmpty()) {
    2. GameObject gate = closeGates.nearest();
    3. // Code to open a gate
    4. }
    5.  
     
  6. Cloud

    Cloud Engineer

    Joined:
    Jul 28, 2013
    Messages:
    2,777
    Likes Received:
    1,124
    I'd recommend finding something else besides the id, the id is unstable and prone to changes by Jagex.
     
  7. mrpiccard

    Joined:
    Mar 20, 2015
    Messages:
    3
    Likes Received:
    2
    ah, alright. ill try some of the other methods suggested then. thanks
     
  8. Lad

    Lad

    Joined:
    Feb 6, 2015
    Messages:
    241
    Likes Received:
    69
    You can try using coordinates at each side of the door, and check if it's reachable or not. If it's not reachable. door.interact("Open");
    I personally haven't done it but if I did that's how I'd do it.
     
  9. Cloud

    Cloud Engineer

    Joined:
    Jul 28, 2013
    Messages:
    2,777
    Likes Received:
    1,124
    Just remember that reachability is an intense calculation is done frequently.
     
    Lad likes this.
  10. red

    red

    Joined:
    Nov 17, 2013
    Messages:
    259
    Likes Received:
    111
    Yes but it is hard not to use it at times. Especially when you have absolutely no choice.
     
  11. Cloud

    Cloud Engineer

    Joined:
    Jul 28, 2013
    Messages:
    2,777
    Likes Received:
    1,124
    I've yet to encounter a single situation like that, I've always managed to find a solution even when it seemed really impractical.
     

Share This Page

Loading...