Jump 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.

Disable Auto-Login?

Featured Replies

Hey, just wondering if there’s a way to disable auto-login, whether it be in the settings or a way to specify it in the script. I couldn't find anything in the API docs, but I could have easily missed something.


I'd mainly like to know because its important that my script uses it's own login handling code.

Hey, just wondering if there’s a way to disable auto-login, whether it be in the settings or a way to specify it in the script. I couldn't find anything in the API docs, but I could have easily missed something.

I'd mainly like to know because its important that my script uses it's own login handling code.

 

        this.bot.getRandomExecutor().unregisterHook(RandomEvent.AUTO_LOGIN);
 
or 
 
        this.bot.getRandomExecutor().registerHook(new RandomBehaviourHook(RandomEvent.AUTO_LOGIN)
        {
            public String getName() {
                return super.getName();
            }
 
            public boolean shouldActivate()
            {
                return false;
            }
        });
 
you will also probably need to disable world hopper system if you are using it.
 
To make the actual login handler, you need to make a new thread and run it on that, otherwise you can't run anything on the script until logged into game.
  • Author

Thanks for the reply ohmy.png Exactly what I was looking for.


So the script doesn't run until it's logged in, do you happen to know if it stops the active script on log out or?

Edited by Aerospark

  • Author

Bit of a follow up to this, it is possible to access the random solvers before the login screen, onStart runs pretty much right away, but the login solver seems to be in RandomExecutor.otherSolvers instead of the standard solver map. I'm not sure if I can access this without using reflection, will edit this post with more info shortly.


EDIT: Here's the code I eventually ended up using, it's a bit overboard, but it does work

 

public void clearALLRandomHooksAndSolvers() throws IllegalAccessException, SecurityException, NoSuchFieldException{
        bot.getRandomExecutor().clearHooks(); // does nothing
        bot.getRandomExecutor().unregisterHook(RandomEvent.AUTO_LOGIN); // also does nothing
        RandomExecutor exec = bot.getRandomExecutor();
        Field other = exec.getClass().getDeclaredField("otherSolvers");
        other.setAccessible(true);
        ((Set<RandomSolver>)other.get(exec)).clear();
        Field solver = exec.getClass().getDeclaredField("solvers");
        solver.setAccessible(true);
        ((Map<RandomEvent, RandomSolver>)solver.get(exec)).clear();
        Field hooks = exec.getClass().getDeclaredField("hooks");
        hooks.setAccessible(true);
        ((Map<RandomEvent, RandomBehaviourHook>)hooks.get(exec)).clear();
}

Edited by Aerospark

Guest
This topic is now closed to further replies.

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

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.