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.

dialogue box help

Featured Replies

working on a cooking script after i use my fish on the range the box pops up asking how many to fish how can i get the script to interact with the box to select cook all (same with fletching and alot of other skills) plz help

Widgets

if (getWidgets().isVisible(parent,child) {
    getWidgets().interact(parent, child, action)
 }

you can get widgets from the debugger

Edited by Assnerd


Widgets ok = getWidgets().getWidgetContainingText("Howm anyblablabla?");

ok.interact("Cook-All");

Have you tried turning it off and on again?

if (widgets.getAll().stream().filter(w -> w.isVisible() && w.hasAction("Cook All")).count > 0) 
widgets.getAll().stream().filter(w -> w.isVisible() && w.hasAction("Cook All")).findFirst().get().interact("Cook All");

The above code will select the option "Cook All" on any widget if the widget is visible. Make sure the action is spelled correctly with uppercase C and A as I don't know if it's supposed to be uppercase or lowercase A.

  • Author

awesome thank you guys ill give this a try and see how it goes :)


Have you tried turning it off and on again?

 

yea multiple time lmao

if (widgets.getAll().stream().filter(w -> w.isVisible() && w.hasAction("Cook All")).count > 0) 
widgets.getAll().stream().filter(w -> w.isVisible() && w.hasAction("Cook All")).findFirst().get().interact("Cook All");

The above code will select the option "Cook All" on any widget if the widget is visible. Make sure the action is spelled correctly with uppercase C and A as I don't know if it's supposed to be uppercase or lowercase A.

 

 

That's inefficient as hell. Why aren't you caching the Widget from the first query and reusing it?

That's inefficient as hell. Why aren't you caching the Widget from the first query and reusing it?

Filtering streams is actually very fast. You may cache the widget if you want but then you will continously null check it and verify its visibility which you pretty much do with the above code.

 

As a general rule when writing code, you first make it work and in future iterations you begin optimising it.

Filtering streams is actually very fast. You may cache the widget if you want but then you will continously null check it and verify its visibility which you pretty much do with the above code.

 

As a general rule when writing code, you first make it work and in future iterations you begin optimising it.

 

You're talking to the wrong person about "general rules of writing code". It doesn't matter if it's "fast", you're sacrificing readability & performance for absolutely no reason. You shouldn't write shit code when another (better) solution is so blatantly obvious. Not only is it shorter (and therefore more readable), but it performs significantly faster.

 

Also, your code has a race condition. If the Widget state changes in between those 2 calls, you're going to get an NPE depending on the API implementation.

 

tl;dr stop giving shit, buggy code to beginners

Edited by demmonic

  • Author

You're talking to the wrong person about "general rules of writing code". It doesn't matter if it's "fast", you're sacrificing readability & performance for absolutely no reason. You shouldn't write shit code when another (better) solution is so blatantly obvious. Not only is it shorter (and therefore more readable), but it performs significantly faster.

 

Also, your code has a race condition. If the Widget state changes in between those 2 calls, you're going to get an NPE depending on the API implementation.

 

tl;dr stop giving shit, buggy code to beginners

 

lol i didnt understand half of what u said lmao i dont know how to do much for scripting so im sure most of my code is broken or insufficient anyway just trying to make something actually work for learning until i understand alot more so i can actually release scripts any advise or maybe tutorials u recommend are appreciated.. :) 

lol i didnt understand half of what u said lmao i dont know how to do much for scripting so im sure most of my code is broken or insufficient anyway just trying to make something actually work for learning until i understand alot more so i can actually release scripts any advise or maybe tutorials u recommend are appreciated.. smile.png

 

I don't really care for tutorials as you can't really encompass a whole language in something that small. I would recommend a book to get an overview of the language, and to act as a reference when you can't figure something out (google helps too.) Other than that, practice makes perfect.

 

The sole reason I don't like people suggesting stuff like that to a beginner is because it's easy to form habits when you don't know any better, but it's generally hard to change them.

 

Anyways, you can always PM me your Skype if you want real time help. I'd be happy to help/give advice in my free time.

  • Author

I don't really care for tutorials as you can't really encompass a whole language in something that small. I would recommend a book to get an overview of the language, and to act as a reference when you can't figure something out (google helps too.) Other than that, practice makes perfect.

 

The sole reason I don't like people suggesting stuff like that to a beginner is because it's easy to form habits when you don't know any better, but it's generally hard to change them.

 

Anyways, you can always PM me your Skype if you want real time help. I'd be happy to help/give advice in my free time.

 

that sounds awesome thank you any particular book u recommend??i think alot of my issues when it comes to writing code (besides being new to it) is i dont know the commands and what all the commands mean and do

You're talking to the wrong person about "general rules of writing code". It doesn't matter if it's "fast", you're sacrificing readability & performance for absolutely no reason. You shouldn't write shit code when another (better) solution is so blatantly obvious. Not only is it shorter (and therefore more readable), but it performs significantly faster.

 

Also, your code has a race condition. If the Widget state changes in between those 2 calls, you're going to get an NPE depending on the API implementation.

 

tl;dr stop giving shit, buggy code to beginners

I highly doubt flaming me for trying to help him solve his problem is going to get you anywhere. But if you do insist on trying to prove I'm wrong, you aren't going to get anywhere because simply by saying that my condition is wrong and the widget state can change between those 2 calls prove you don't know anything about scripting, the OSBot API or programming in general.

 

Some reputable scripters on this site have public APIs they implemented in their scripts which you might want to take a look at before accusing my code of being "shit", you definately have a lot to learn from that and you might be surprised to find solutions very similar to the one I presented above.

 

TL;DR: Find something constructive to do with your time.

I highly doubt flaming me for trying to help him solve his problem is going to get you anywhere. 

 

...

 

TL;DR: Find something constructive to do with your time.

I'm not flaming in any way. Yes, I called the tiny snippet of code you posted buggy, and "shit". That is not me flaming you in any way. If you want to get all defensive and post bullshit insults towards me as a person (you've done this several times now, acting like I'm an idiot who doesn't know how to program), then go for it, pal. You're the one that needs to find something constructive to do with your time.

 

But if you do insist on trying to prove I'm wrong, you aren't going to get anywhere because simply by saying that my condition is wrong and the widget state can change between those 2 calls prove you don't know anything about scripting,

Prove it then buddy. I'm a bot developer unlike you, and unless the scripting is handled on the game engine's thread (it's not.) You have a race condition!

 

Some reputable scripters on this site have public APIs they implemented in their scripts which you might want to take a look at before accusing my code of being "shit", you definately have a lot to learn from that and you might be surprised to find solutions very similar to the one I presented above.

Ok? So you're going to defend yourself by saying that other bad developers are doing what you're doing? Hooray for confirmation bias! Also, more passive aggressive insults via your big ego! Yes yes, you know everything, and I know nothing.

 

Please don't even bother replying to me, I'm ending this here. You're too stupid to listen to anything I have to say. You throw personal insults everywhere, go off topic, and are extremely stubborn.

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.