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.

Script causing insane lag, gets worse over time until it crashes

Featured Replies

https://pastebin.com/xagtE9jK

 

Very simple script, not sure how I am possibly having something "leak" to cause an increased amount of lag starting from minute 1 until it eventually crashes after 20minutes or so. 

 

 

Note: the 

        if(players.myPlayer().isAnimating()){
            log("animating");
            if(random(1,30) == 1){
                if(random(1,2) == 1){
                    log("backspace");
                    getKeyboard().pressKey(8);
                    getKeyboard().releaseKey(8);
                }else{
                    log("random letter");
                    Random r = new Random();
                    char c = (char)(r.nextInt(26) + 'a');
                    new TypeStringEvent(Character.toString(c), false);
                }

            }
        }

block is the only block ever getting executed during lagging portion. 

Edited by Brian

Mirror mode or stealth?

Also what OS you using?

 

I've ran your code for about 10 mins now, on mirror mode. The fps is still at the max amount of 50.

Try running simplified blocks, and slowly start adding in more code to see when it starts happening.

Edited by BravoTaco

NVM Just saw the pastebin

One thing that I have noticed is that you have a 30 second time out on your conditional sleep?

Edited by Protoprize
Stupidity on my side

  • Author
29 minutes ago, BravoTaco said:

Mirror mode or stealth?

Also what OS you using?

 

I've ran your code for about 10 mins now, on mirror mode. The fps is still at the max amount of 50.

Try running simplified blocks, and slowly start adding in more code to see when it starts happening.

W10, Mirror Mode.    I changed my random method from

random(..,..)

to

ThreadLocalRandom.current().nextInt(..,..+1)

And it has seemed to have solved the problem.  Very weird :)

 

26 minutes ago, Protoprize said:

NVM Just saw the pastebin

One thing that I have noticed is that you have a 30 second time out on your conditional sleep, I'm pretty sure that has something to do with it  

That code is never reached, just a failsafe.  I removed it and had the same issue.  

7 minutes ago, Brian said:

W10, Mirror Mode.    I changed my random method from


random(..,..)

to


ThreadLocalRandom.current().nextInt(..,..+1)

And it has seemed to have solved the problem.  Very weird :)

 

Very odd. As the random() method just uses the Random class from java. But atleast its working now 🙂 

  • Author
3 hours ago, BravoTaco said:

Very odd. As the random() method just uses the Random class from java. But atleast its working now 🙂 

Okay, I spoke too soon, it started happening again, I removed everything from my script but the following...  All I am trying to do is stop my account from logging out.  Ugh, have written tons of scripts that are infinetly more complex, why does this one have so many issues :( .. seems to take longer before it runs into issues though.  Before I noticed it after a few minutes, now it runs for about 30 minutes before I start noticing the lag, maybe a hour until crash happens. 

 

@Override
public int onLoop() {
    if(players.myPlayer().isAnimating()){
        getKeyboard().pressKey(8);
        getKeyboard().releaseKey(8);
    }
    return ThreadLocalRandom.current().nextInt(60000, 240000);
 }

 

Edited by Brian

Quote

public void pressKey(int keyCode)
Sends a KEY_PRESSED event to the key event handler. Note: only for keys that have no 'character'. Do NOT use for Esc key (and probably a couple of other keys).
Parameters:
keyCode - The KeyCode for the key to type.

 

This could be your problem.

 

Try getKeyboard().pressKey(VK_Z) // z constant

  • Author
1 hour ago, dreameo said:

 

This could be your problem.

 

Try getKeyboard().pressKey(VK_Z) // z constant

Hmm okay, I see how that could be a program.  It does send a backspace, though looks like it may not be recommended.  If I send a Z key or something it will fill up my chat and eventually stop entering so It will eventually stop keeping me logged in, so will need to find another method to stay logged in if the backspace is the issue.

  • Author
1 hour ago, dreameo said:

 

This could be your problem.

 

Try getKeyboard().pressKey(VK_Z) // z constant

Tried switching to Z temporarily, started lagging after a few minutes. 

Try changing from typing a key to just moving the camera randomly.

Edited by BravoTaco

  • Author
14 hours ago, BravoTaco said:

Try changing from typing a key to just moving the camera randomly.

 

The issue was mirror mode.  Injection works fine, ugh :( so looks like no fix on my end is possible.

15 hours ago, Brian said:

 

The issue was mirror mode.  Injection works fine, ugh :( so looks like no fix on my end is possible.

You could also try

getKeyboard().typeString("Z", false)

Create an account or sign in to comment

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.