Open and close gate?

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

  1. 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. 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. 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. thank you! i actually just realized the ID is different
  5. 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. }
  6. I'd recommend finding something else besides the id, the id is unstable and prone to changes by Jagex.
  7. ah, alright. ill try some of the other methods suggested then. thanks
  8. 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. Just remember that reachability is an intense calculation is done frequently.
    Factionless likes this.
  10. Yes but it is hard not to use it at times. Especially when you have absolutely no choice.
  11. 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