Jump to content

How to manually login to accounts?


Recommended Posts

Posted (edited)

Hey guys,

I'm trying to make my script manually login to my accounts but for some reason clicking/typing doesn't work when I'm logged off. This is what I got:

 

Triggering my state:

if(!client.isLoggedIn())
return State.LOGIN;

Code in my case:

case LOGIN:
mouse.click(460, 290, false);
getKeyboard().typeString("USERNAME HERE", true);
sleep(random(500, 1500));
getKeyboard().typeString("PASSWORD HERE", true);
sleep(random(4000,5000));
mouse.click(380, 330, false);
sleep(random(4000,5000));
break;

For some reason it seems to "work" when I'm online, but when I'm offline it just doesn't seem to trigger.

 

Thanks alot in advance!

 

Cheers,

ForcaNL

Edited by ForcaNL
Posted

I'm not sure if it's still possible to unregister or hook autologin, I used to do that but it stopped working at some point. However, you can do something hacky like:

 

try {
         Field f = bot.getClass().getSuperclass().getDeclaredField("account");
         f.setAccessible(true);
         f.set(bot, new RSAccount());
        } catch (NoSuchFieldException e) {
            log("bad mkay");

        } catch (IllegalAccessException e) {
            log("bad mkay");
        }

Which makes sure the autologin doesn't trigger. You definitely don't want to push something like that to the SDN, but it's fine for private usage. At this point nothing happens because the scriptexecutor doesn't call onLoop() when the client is not logged in.

To solve this you could create a Thread in onStart which runs in the background
 

new Thread(() -> {

            while(running && !Thread.interrupted()) {

                if(!client.isLoggedIn()) {
                    log("Logging in!");

                    try {

                        mouse.click(460, 290, false);
                        getKeyboard().typeString("USERNAME HERE", true);
                        sleep(random(500, 1500));
                        getKeyboard().typeString("PASSWORD HERE", true);
                        sleep(random(4000,5000));
                        mouse.click(380, 330, false);
                        sleep(random(4000,5000));

                    } catch (InterruptedException e) {
                    }

                }


                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                }
            }

        }).start();

Seems to work for me :)

  • Like 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...