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 optimisations to reduce lag

Featured Replies

I've noticed that the client lags considerably when running my script.
What measures can I take to ensure that my script consumes as little resources as possible?
I've increased the onLoop counter to reduce loops per minute and am also using a series of "else if" conditional statements instead of a series of "if" statements to reduce the number of conditions checked.

What else can I do?

7 minutes ago, Adept said:

I've noticed that the client lags considerably when running my script.
What measures can I take to ensure that my script consumes as little resources as possible?
I've increased the onLoop counter to reduce loops per minute and am also using a series of "else if" conditional statements instead of a series of "if" statements to reduce the number of conditions checked.

What else can I do?

It would be helpful if you showed us the source code so we can tell you where you are going wrong.

Also in the future please post in the Scripting Help section

4 minutes ago, Juggles said:

Don't use webWalk 

^

 

Define static paths if you can, it's helped me manage my resources a lot.

 

Look out for NPE's in the debugger aswell

chances are that if your code is really laggy, using else ifs vs. ifs wont really help. you're probably doing an inefficient calculation or something that takes a ridiculous amount of time, either in your onLoop() or onPaint(). also check that you're not getting any exceptions

if you want specific help, you'll need to post your source code.

  • Author
12 minutes ago, Juggles said:

Don't use webWalk 

Interesting. Can you explain why not? Should I use WalkingEvents instead?

Just now, Adept said:

Interesting. Can you explain why not? Should I use WalkingEvents instead?

Just look at your memory before and after webwalker is called 

41 minutes ago, Juggles said:

Don't use webWalk 

I think that the user means CPU usage, webWalking isn't very CPU intensive after it calculates the route. It does consume 200-300MB ram, but that is to be expected

First of all, I'd suggest to use ConditionalSleeps where applicable. Many beginning scripters tend to put their codebase into one giant loop with a lot of condition checking

A smarter way is to split up your script into 'Tasks' or 'States' paired with a getTask(), getState(), or similar.

When a task has been executed you conditionalsleep until a certain condition is met (or it times out). Using this method I can easily run 50 clients on a modern quad core CPU

Something along the lines of :

uiYWLdi.png

O35SViy.png

V3dRTzl.png

XWAKqxz.png

There are many ways to accomplish this, so don't limit yourself to my method. I generally write scripts in a rush :boge:

Edited by Abuse

4 minutes ago, Abuse said:

I think that the user means CPU usage, webWalking isn't very CPU intensive after it calculates the route. It does consume 200-300MB ram, but that is to be expected

First of all, I'd suggest to use ConditionalSleeps where applicable. Many beginning scripters tend to put their codebase into one giant loop with a lot of condition checking

A smarter way is to split up your script into 'Tasks' or 'States' paired with a getTask(), getState(), or similar.

When a task has been executed you conditionalsleep until a certain condition is met (or it times out). Using this method I can easily run 50 clients on a modern quad core CPU

 

 

would like to know more
i use states and still get a high cpu/ram usage

To use States isn't faster or less resource expensive... It's just cleaner to read... If you look at the code it's slower and uses more resources. :facep:

34 minutes ago, Soldtodie said:

To use States isn't faster or less resource expensive... It's just cleaner to read... If you look at the code it's slower and uses more resources. :facep:

Exactly what I mean, having code that is clean to read will result in it being easier to find the bottleneck.

Just now, Abuse said:

Exactly what I mean, having code that is clean to read will result in it being easier to find the bottleneck.

how do you use paths? http://explv.github.io/ format for paths gives me an error when i try to use

  • Author

I'm afraid I can't share my source code since it's a private method.
Thanks to all those who've shared some insight! I'll go through the code and amend according to your recommendations.

Edited by Adept

11 minutes ago, Lewis said:

how do you use paths? http://explv.github.io/ format for paths gives me an error when i try to use

Paths have to be in List format now iirc, you can change the output type on my map by clicking the cogwheel

Just now, Explv said:

Paths have to be in List format now iirc, you can change the output type on my map by clicking the cogwheel

btw your map thing is glitching for me now, when i move the map it blacks out like so

c295e5d506.jpg

now i cant select a path or area

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.