Skip 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.

Question about OSBot's synchronous behavior

Featured Replies

Hello, I have just started using the osbot API, just testing things out on my runescape account. I have an okay amount of coding experience, so feel free to answer this question as technically as you want to.

 

Let's say that, for instance, in my code, I talk to a butler and because of that, my state has changed to "States.TALKING_TO_BUTLER" (I know that using states is not the most efficient way to program bots, I am just doing it so I can get familiar with the API). While I am in dialogue with the butler, I expect to press continue once, and then I want to select "Go to bank...". Here is my issue: Once I have invoked dialogues.clickContinue(), there is a delay in the game before dialogues.selectOption("Yes") will work. So, if I have the two lines of code next to each other:

 

dialogues.clickContinue();

dialogues.selectOption("Yes");

 

The "yes" option is never selected because it is invoked before it is actually visible in game. The only way I have found to fix this problem so far is to use the sleep function in-between the invocations, but I think this is inefficient since the waiting period is dependent upon my in-game latency. 

Hello, I have just started using the osbot API, just testing things out on my runescape account. I have an okay amount of coding experience, so feel free to answer this question as technically as you want to.

 

Let's say that, for instance, in my code, I talk to a butler and because of that, my state has changed to "States.TALKING_TO_BUTLER" (I know that using states is not the most efficient way to program bots, I am just doing it so I can get familiar with the API). While I am in dialogue with the butler, I expect to press continue once, and then I want to select "Go to bank...". Here is my issue: Once I have invoked dialogues.clickContinue(), there is a delay in the game before dialogues.selectOption("Yes") will work. So, if I have the two lines of code next to each other:

 

dialogues.clickContinue();

dialogues.selectOption("Yes");

 

The "yes" option is never selected because it is invoked before it is actually visible in game. The only way I have found to fix this problem so far is to use the sleep function in-between the invocations, but I think this is inefficient since the waiting period is dependent upon my in-game latency. 

 

add some if and else if statements calling the these to determine which one to call etc:

 

http://osbot.org/api/org/osbot/rs07/api/Dialogues.html#isPendingContinuation--

http://osbot.org/api/org/osbot/rs07/api/Dialogues.html#isPendingOption--

 

for example:

 

if(this.getDialogues().isPendingContinuation())

     this.getDialogues().clickContinue();

 

etc...

 

Edited by Precise

  • Author

Okay great! So basically, I just need to sort of structure the code around these constant 'ticks' or 'checks' by the onLoop method. As in, I have to prepare for the asynchronous behavior by using methods like the ones you provided etc etc. Thanks so much!

Okay great! So basically, I just need to sort of structure the code around these constant 'ticks' or 'checks' by the onLoop method. As in, I have to prepare for the asynchronous behavior by using methods like the ones you provided etc etc. Thanks so much!

 

Most methods in the API are synchronous. A few exceptions would be the camera API (Camera.toEntity()), and maybe some mouse stuff. When using events, you can set them to async (event.setBlocking(false) I believe?)

You should probably just strive towards only doing 1 action every loop cycle.

Always evaluate the action that currently needs to be done based on the current situation, not by assuming that previous actions completed successfully.

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

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.