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

Question Teleports/Lodestone checks

Discussion in 'Developer Support' started by HAckley, May 21, 2018.

  1. HAckley

    Joined:
    Mar 11, 2018
    Messages:
    19
    Likes Received:
    4
    Hey everyone! I did a quick forum search as well as a look through the jdocs and couldn't find exactly what I was looking for.

    My question: if I am developing a bot that has a few teleports in it that use lodestones I was curious as to how I implement the bot to not spam click a lodestone if the user does not have access to said lodestone (ie lunar isle for example). I'm assuming there is some kind of check/return but I cant seem to find it anywhere.

    maybe I'm looking right at it under lodestone in the jdocs, but I'm not sure

    Any help would be appreciated!

    btw I'm a noobie coder so I apologize that this is a bit menial
     
    #1 HAckley, May 21, 2018
    Last edited: May 21, 2018
  2. Wet Rag

    Wet Rag easily triggered ✌

    Joined:
    Dec 31, 2015
    Messages:
    4,457
    Likes Received:
    1,695
    blacklist that lodestone
     
  3. HAckley

    Joined:
    Mar 11, 2018
    Messages:
    19
    Likes Received:
    4
    Code (Text):
    1. @Override
    2.     public void execute() {
    3.         if (Lodestone.FREMENNIK_PROVINCE.isActivated()) {
    4.             if (Lodestone.FREMENNIK_PROVINCE.teleport()) ;
    5.             Execution.delayWhile(() -> (Players.getLocal().isMoving() || Players.getLocal().getAnimationId() != -1));
    6.  
    7.             } else {
    8.             Environment.getBot().stop("The player doesn't have the correct Lodestone.");
    9.         }
    10.  
    11.     }
    12.  
    13. }
    Seeing as I haven't gotten a serious answer yet @Squidl :p would anyone care to let me know if this would work or not??
     
  4. Derk

    Derk 12 year old normie

    Joined:
    Jan 8, 2015
    Messages:
    2,766
    Likes Received:
    1,339
    Breh.

    You're closing your if statement without a body. This shit shouldn't even compile.

    Edit: it does if you look at the amount of closing brackets but your code will do some fucked up shit like this.
     
  5. HAckley

    Joined:
    Mar 11, 2018
    Messages:
    19
    Likes Received:
    4
    oops I didn't even see that, thanks! and what do you mean by "fucked up shit"? I just want it to simply check to make sure the user has access to the lodestone instead of spamming it if its locked

    edit: do you mean because I was closing it without a body or in general?
    --- Double Post Merged, May 23, 2018, Original Post Date: May 23, 2018 ---
    Code (Text):
    1.  
    2. @Override
    3.     public void execute() {
    4.         if (Lodestone.FREMENNIK_PROVINCE.isActivated()) {
    5.             if (Lodestone.FREMENNIK_PROVINCE.teleport())
    6.             Execution.delayWhile(() -> (Players.getLocal().isMoving() || Players.getLocal().getAnimationId() != -1));
    7.  
    8.             } else {
    9.             Environment.getBot().stop("The player doesn't have the correct Lodestone.");
    10.         }
    11.  
    12.     }
    13. }
    new one (without the un needed ";" closing it too early

    ----------------------

    Further edit: it works the way I thought it would! Thanks Derk for letting me know I missed something!
     
    #5 HAckley, May 23, 2018
    Last edited: May 23, 2018

Share This Page

Loading...