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
  • Errors with Multi-threading java


    kamilo

    Recommended Posts

    Posted

    Basically running a thread constantly to detect skulled players...

    I was noticed a skulled player but my script didnt notify shit.. i got skeptical. Triple checked code, and i found out that somewhere along the line my thread randomly stops working..

    At first i thought maybe if i pause the script it might mess it up but no pause doesnt effect the thread running in background

     @Override
        public void run() {
            while (isRunning) {
                if (inWilderness(player)) ) {
                    MethodProvider.log("...");
                    if (isSkulled(player))
                        MethodProvider.log("inDanger...");
                } else {
                    try {
                        Thread.sleep(2000);
                        MethodProvider.log("Enemy Detector Thread sleeping (2s) -- Not in Wilderness...");
                    } catch (InterruptedException e) {
                        MethodProvider.log("Error at inWilderness (thread): " + e.toString());
                    }
                }
            }
    		//**Put a output log at the end of the loop to see if the loop ends somehow
            MethodProvider.log("Exisiting out of while loop..");
        }

    But oddly enough the loop doesn't exit cuz i dont see the "Exisiting out of while loop." log.

    Has anyone dealt with this please help...

    Here's the screeshot of console:

    mwP2Gx3.png

    As you can see it randomly stops scanning, i dont see any error messages even though i've logged them properly. I can't seem to figure it out..

    please help

    Posted

    As far as i know threads are endless, i was manually hopping around while testing my script and maybe it has something to do with that not sure as of yet. But yeah...

    Posted

    update throwablw didnt do jack shit idk wtf is wrong

    Posted

    Also, is there a check i can add to not scan if the screen hasnt done loadinng (hopping)

    Posted
    1 hour ago, kamilo said:

    Basically running a thread constantly to detect skulled players...

    I was noticed a skulled player but my script didnt notify shit.. i got skeptical. Triple checked code, and i found out that somewhere along the line my thread randomly stops working..

    At first i thought maybe if i pause the script it might mess it up but no pause doesnt effect the thread running in background

     @Override
        public void run() {
            while (isRunning) {
                if (inWilderness(player)) ) {
                    MethodProvider.log("...");
                    if (isSkulled(player))
                        MethodProvider.log("inDanger...");
                } else {
                    try {
                        Thread.sleep(2000);
                        MethodProvider.log("Enemy Detector Thread sleeping (2s) -- Not in Wilderness...");
                    } catch (InterruptedException e) {
                        MethodProvider.log("Error at inWilderness (thread): " + e.toString());
                    }
                }
            }
    		//**Put a output log at the end of the loop to see if the loop ends somehow
            MethodProvider.log("Exisiting out of while loop..");
        }

    But oddly enough the loop doesn't exit cuz i dont see the "Exisiting out of while loop." log.

    Has anyone dealt with this please help...

    Here's the screeshot of console:

    mwP2Gx3.png

    As you can see it randomly stops scanning, i dont see any error messages even though i've logged them properly. I can't seem to figure it out..

    please help

    Please show the whole code, where is "player" coming from?

    Posted
    18 hours ago, Neffarion said:

    Please show the whole code, where is "player" coming from?

    kk, well i just put my code inside try and catch block and that seems to fix it! thanks so much for your help

    Posted
    1 hour ago, kamilo said:

    kk, well i just put my code inside try and catch block and that seems to fix it! thanks so much for your help

    You shouldn't be doing that but alright

    Posted
    2 hours ago, Neffarion said:

    You shouldn't be doing that but alright

    how come?

    Posted
    18 hours ago, kamilo said:

    how come?

    Wrapping everything in a try catch block is just lazy, overall bad design, and it will affect the performance of your script. You should be finding the source of the issue and deal with it accordingly.

    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.