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
  • Script continues running long after I stop it


    logic0671

    Recommended Posts

    EDIT: 

    I removed all while loops from my script that weren't completely necessary.

    This fixed my problem!

    Basically a log message continuously repeated like 5 mins after I stopped a script.

    Even when I straight up closed the tab it kept going until I exited-out of the entire client.

    Area fightAreaExit = new Area(2691, 3286, 2700, 3278, 0);
    while (!fightAreaExit.contains(getLocalPlayer()))
    {
        log("Line 81");
        exit.interact("Climb-up");
    }
    Link to comment
    Share on other sites

    49 minutes ago, logic0671 said:

    Code added.

    Your mistake is using the while loop in a script. You shouldn't be using it because the script only stops after finishing the current loop on your onLoop (which never does if you use a loop inside of it)

    The script already loops on the onLoop function, why are you using another loop inside it?

    Link to comment
    Share on other sites

    2 hours ago, logic0671 said:

    Ok, I understand.

    So nobody ever uses while loops inside of DB scripts?

    Also, do you have a suggestion of how I can re-write it?

    Its generally good practice to not use loops unless you absolutely need them
    If that code is all you have in the onLoop then you can just replace the while with an if

    Link to comment
    Share on other sites

    Archived

    This topic is now archived and is closed to further replies.

    ×
    ×
    • 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.