Jump to content

How to manually login to accounts?


ForcaNL
 Share

Recommended Posts

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
Link to comment
Share on other sites

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
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

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