Jump to content
Frequently Asked Questions
  • Are you not able to open the client? Try following our getting started guide
  • Still not working? Try downloading and running JarFix
  • Help! My bot doesn't do anything! Enable fresh start in client settings and restart the client
  • How to purchase with PayPal/OSRS/Crypto gold? You can purchase vouchers from other users
  • Try asking for help in the chatbox
  • Properly stopping a script within onStart, before onLoop is called


    Recommended Posts

    Calling stop() doesn't prevent the script from continuing to onLoop(). I took a look at setState(ScriptManager.State), but the enum ScriptManager.State apparently isn't accessable (says it is in the API, but doesn't exist when trying to access it). I do not want the script to reach onLoop() after attempting to stop it in onStart().


    I'm working with a JOptionPane which sets some properties for the bot (where to bot, the antiban rate); this pane is displayed when onStart() gets called. If the script user decides to X out of the pane or click cancel, I want to stop the script, before it hits onLoop(). Since I initialize the properties only if the script user clicks accepts (assumg he wants to exit the script on X or cancel), I get a NullPointerException for the properties not being set by the time onLoop() comes around.


    I don't want to initialize the properties if the user clicks cancel or Xs out (doesn't make sense to do so). I want the script to completely exit. I'm working on someone else's script, and the method they used to attempt to stop the script was stop(). I'm looking for a way to manually end the script without it continuing onto the actual processing part (onLoop()). How can I do this?


    I'm sure you guys don't need a code example, but just to be safe: (omitted a lot of things in script owner's respect)

    public void onStart() {
         int choice = /* init JOptionPane */;
         if(choice == JOptionPane.OK_OPTION) {
              //init bot properties
         } else {
              stop(); //stop script completely; don't continue to onLoop

    Couldn't find the answer to this anywhere else, so sorry if it has been asked before

    Edited by Dioxin
    Link to comment
    Share on other sites

    Fixed, and will be in the next version, thanks for the report :)

    Ah, was unaware it was an actual problem or I would have posted in the correct section. Thanks for the quick reply
    Link to comment
    Share on other sites

    • Create New...

    Important Information

    We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.