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.

Help a newbie

Featured Replies

Hello and happy Christmas everyone, I'm really new on scripting and started to make my first script (simple power fisher). After coding the basis I tried to run the script on a test account, but after the login handler logs in the account, the client pretty much freezes and processor goes 100%, anyone has an idea where I messed up? I think I'm returning something somewhere where I shouldn't

code.jpg

Edited by xakingas

the scriptmanifest has a missing parameter logo

version = 0, logo = "")

more:

getAnimation == -1 is same as !if(myPlayer().isAnimating() {

i would avoid returning the value 444 or anything else than 0, the script needs to work like clockwork because logic will break

+ the bot will be sluggish (it adds up weird pattern characteristics on top )

use conditional sleeps on condition, static sleeps are more or less used for debugging

conditional sleeps make sure that if your latency spikes or irrelevant event occurs, ur script still sleeps --> very until the condition is done

Edited by extatus

6 hours ago, xakingas said:

After coding the basis I tried to run the script on a test account, but after the login handler logs in the account, the client pretty much freezes and processor goes 100%, anyone has an idea where I messed up?

I'm not sure if this will fix the problem but you should't have a variable holding the inventory instance. Just get the inventory instance every time you need to use it. And fishing spots are npcs, not objects.

6 hours ago, extatus said:

i would avoid returning the value 444 or anything else than 0, the script needs to work like clockwork because logic will break

:???:

Your inv variable is not in the proper scope of your script.

You are checking if the inventory is full in your onloop, but your inv variable is outside of the onloop, maybe it's right but it looks wrong to me. Also you are using a while loop which is frowned upon because your onloop is already an endless loop. Two endless loops is redundant. All you need to do is check if your player is animating there is a function. myPlayer().isAnimating() I think.

The way I would do it would be this:

if (!myPlayer().isAnimating()) {
  RS2Object Bubul = getObjects().closest(1530);//bubbles
  if (Bubul != null) {
    Bubul.interact("Net");
    new ConditionalSleep(5_000) {
      @Override
      public boolean condition() throws InterruptedException {
      	return myPlayer().isAnimating();
      }
    }.sleep();
  }
}

 

4 hours ago, Script Kid said:

I'm not sure if this will fix the problem but you should't have a variable holding the inventory instance. Just get the inventory instance every time you need to use it. And fishing spots are npcs, not objects.

:???:

Just to clarify, as i posted that in 5 am. :lol:

As Haysae mentioned, the onLoop is already an endless loop.  If your script breaks to ping fluctuation or script not looping perfectly, using >0 return values means artificially recreating slugginess that is completely unnecessary. If the script skips lines, it mightn't find your condition on the first try. 

On top of that, if the script were fairly simple and did 1-2 actions before naturally looping again, the outcome would be sluggy anyway.

  • Author
9 hours ago, Script Kid said:

I'm not sure if this will fix the problem but you should't have a variable holding the inventory instance. Just get the inventory instance every time you need to use it. And fishing spots are npcs, not objects.

:???:

Thank you, the inventory was probably breaking it up, works fine now, THANKS!

10 hours ago, xakingas said:

Thank you, the inventory was probably breaking it up, works fine now, THANKS!

FYI it was breaking because you're calling getInventory() before the inventory is available. Most API functions should be saved for your onLoop() as they require the game to be loaded / an account logged in to work correctly. 

On 12/26/2018 at 12:51 PM, extatus said:

Just to clarify, as i posted that in 5 am. :lol:

As Haysae mentioned, the onLoop is already an endless loop.  If your script breaks to ping fluctuation or script not looping perfectly, using >0 return values means artificially recreating slugginess that is completely unnecessary. If the script skips lines, it mightn't find your condition on the first try. 

On top of that, if the script were fairly simple and did 1-2 actions before naturally looping again, the outcome would be sluggy anyway.

Sorry, that is simply not true.

The number returned by the onLoop method is amount of time the script executor will wait before invoking the method again. If this delay is set to 0, it will attempt to run the script as fast as possible, invoking the method as many times per second as your CPU can. Since the server updates the game at the very slow pace of 100 times per minute, having 1 ms or less delay between iterations is unnecessary, extremely inefficient, and can even cause the client to freeze (happened a few minutes ago when I tested running with 0 ms delay).

Most scripting tutorials recommend adding a delay, this one included:

And it was made by @Alek.

1 hour ago, Script Kid said:

Sorry, that is simply not true.

The number returned by the onLoop method is amount of time the script executor will wait before invoking the method again. If this delay is set to 0, it will attempt to run the script as fast as possible, invoking the method as many times per second as your CPU can. Since the server updates the game at the very slow pace of 100 times per minute, having 1 ms or less delay between iterations is unnecessary, extremely inefficient, and can even cause the client to freeze (happened a few minutes ago when I tested running with 0 ms delay).

Most scripting tutorials recommend adding a delay, this one included:

And it was made by @Alek.

I stand corrected. In that case, you're completely right .

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.