Skip to content
View in the app

A better way to browse. Learn more.

OSBot :: 2007 OSRS Botting

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

never returns to onLoop()

Featured Replies

Using Client Version: 1.62


Issue: Don't know exact how, but most of the time it was after the bot tried to walk to somewhere it did came out of the function, but never returned to the onLoop().  

 

Example:

 

 

public int onLoop()
    {
        try
        {
            
            switch(state)
            {
                case FIGHTMID:
                    stateCount = 1;
                    return fightmid();
                case GETONBOAT:
                    stateCount = 2;
                    return getonboat();
                case INSIDEBOAT:
                    stateCount = 3;
                    return insideboat();
                case WHEREAMI:
                    stateCount = 4;
                    return whereami();
                case DOORSOUTHWEST:
                    stateCount = 5;
                    return doorsouthwest();
                case FIGHTSOUTHWEST:
                    stateCount = 6;
                    return fightsouthwest();
                case DOORSOUTHEAST:
                    stateCount = 7;
                    return doorsoutheast();
                case FIGHTSOUTHEAST:
                    stateCount = 8;
                    return fightsoutheast();
                case DOOREAST:
                    stateCount = 9;
                    return dooreast();
                case FIGHTEAST:
                    stateCount = 10;
                    return fighteast();
                case DOORWEST:
                    stateCount = 11;
                    return doorwest();
                case FIGHTWEST:
                    stateCount = 12;
                    return fightwest();
                case COORDINATES:
                    stateCount = 13;
                    return coordinates();
                case JUSTONISLAND:
                    stateCount = 14;
                    return justonisland();
                case EXCHANGE_POINTS:
                    stateCount = 15;
                    return exchange_points();
                case BANKING:
                    stateCount = 16;
                    return banking();
                default:
                    log("fout in de onLoop");
            }
        }
        catch (InterruptedException e)
        {         
                log("its rude to interrupt");            // <---- VERY IMPORTANT ----> \\
} catch (Exception e)
{
e.printStackTrace();
stuckCount++;
if(OUTSIDE_BOAT_AREA.contains(client.getMyPlayer()))
{
    state = State.GETONBOAT;
}

return random(50,150);
}
        return random(100);
        
}

 

 

 

 

 

 

Edited by redeye

nvm

Edited by Someluser

  • Author

Back to basics for you.

 

give hints instead of making a fool of me. 

 

Back to basics for you.

 

give hints instead of making a fool of me. 

 

You should really do so. You'll soon find out where your mistakes are in 2 secs.

  • Author

 

 

Back to basics for you.

 

give hints instead of making a fool of me. 

 

You should really do so. You'll soon find out where your mistakes are in 2 secs.

 

The only thing i forgot are breaks, dont know what else... hints pl0x

I'll help you out. Rather then doing a try and catch, just throw an InterruptedException. Also, where it says switch, wtf is (state). You should create a new method called getState().

Example:

Switch(getState()){

}

Now, Create an enum of states.

Example:

Public nameOfEnum enum {

RUN, SLEEP, LEARN

};

Within the getState() method you would create condition and make it return the states.

For example if you have a state called "RUN". Your onLoop would look like

Switch(getState()){

case RUN: (the name of the state from your enum)

return runFrom(); (name of the new method you want it to perform).

Or

case SLEEP:

(Put your code with in here).

Break;

}

Let me know if you still need more help

Edited by josedpay

  • Author

I'll help you out. Rather then doing a try and catch, just throw an InterruptedException. Also, where it says switch, wtf is (state). You should create a new method called getState().

Example:

Switch(getState()){

}

Now, Create an enum of states.

Example:

Public nameOfEnum enum {

RUN, SLEEP, LEARN

};

Within the getState() method you would create condition and make it return the states.

For example if you have a state called "RUN". Your onLoop would look like

Switch(getState()){

case RUN: (the name of the state from your enum)

return runFrom(); (name of the new method you want it to perform).

Or

case SLEEP:

(Put your code with in here).

Break;

}

Let me know if you still need more help

 

aaah i get it now haha thx! Is it persee needed to say return (runfrom()) cant it just be runFrom() without the return? and than break;  or is it the same haha:

 

case RUN:

return runFrom();

 

====

 

case RUN:

runFrom();

break;

 

will change to interruptedException! I think there is the problem that it doesnt call the onLoop() anymore.  I had a log in my onloop when the bug occured it never spammed what was in that log. And the paint was still running. So yeah i think its the try catch problem i hope. Will change it today and run it overnight smile.png   edit:-- still got stuck

 

  

 

i now have:

 

State state = State.WHEREAMI;

 

enum State

    {

        FIGHTMID, FIGHTWEST, FIGHTEAST, BANKING, EXCHANGE_POINTS, GETONBOAT, INSIDEBOAT, WHEREAMI

        ,FIGHTSOUTHWEST,FIGHTSOUTHEAST, COORDINATES, JUSTONISLAND, DOOREAST, DOORWEST, DOORSOUTHEAST,

        DOORSOUTHWEST

    } (do you need to ; this?)

 

is getState() already a function or do you need to make it yourself? If you need to make it yourself how would it look like?

Edited by redeye

  • Author

i changed it to interruptedException and now i see that i have alot of nulpointerexception, which i didnt have before. So was that the problem? If i fix these nulpointerexception my onloop wont suddenly stop working?

nullpointerexeception wont stop it from working anyways, it just spams errors in the client.

You still need to catch the nullpointer OR check for a null pointer != null

  • Author

nullpointerexeception wont stop it from working anyways, it just spams errors in the client.

You still need to catch the nullpointer OR check for a null pointer != null

 

Yeah figured as much. Will do everywhere a != null check.

 

onLoop is called in a thread, so the thread closed somehow. And i found on the internet that a thread can only close when

 

"

  • The exit method of class Runtime has been called and the security manager has permitted the exit operation to take place.
  • All threads that are not daemon threads have died, either by returning from the call to the run method or by throwing an exception that propagates beyond the run method.

"

 

And i think the last one, that a daemon thread throw an exception that propagates beyond the run method, what do you guys think?

 

This "closing thread that calls onLoop" thingie happened after a simple walk(). 

 

Hmm i should make my own thread and call onLoop haha will that solve it? Probably not haha.

                log("its rude to interrupt");            // <---- VERY IMPORTANT ----> \\

You are supposed to throw the execption.

  • Author

you should check whether your onLoop actually returns after the walking

 

It did return after the walking but than at the end of the function it didnt go back to onLoop.

 

 

              log("its rude to interrupt");            // <---- VERY IMPORTANT ----> \\

You are supposed to throw the execption.

 

I know have:

public int onLoop() throw interruptedException 

 

Is that good?

Guest
This topic is now closed to further replies.

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.