-
Posts
2314 -
Joined
-
Last visited
-
Days Won
6 -
Feedback
100%
Everything posted by Explv
-
Sure I'll add another location
-
item.getName().startsWith("Stamina potion") - Find in order of dose
Explv replied to harrypotter's topic in Scripting Help
Thanks boss -
item.getName().startsWith("Stamina potion") - Find in order of dose
Explv replied to harrypotter's topic in Scripting Help
You could try doing something like this if you just want to get a single potion: Optional<Item> staminaPotion = Arrays.stream(getBank().getItems()) .filter(item -> item != null && item.getName().startsWith("Stamina potion")) .min(Comparator.comparing(Item::getName)); This snippet will construct a Stream from the array of all items in the bank, filter it so that only the items which are not null and has a name beginning with "Stamina potion" remain, and then find the min of those using a Comparator to compare the Item names, this should return Stamina potion (1) first etc. Note: it returns an Optional<Item>, the Optional class can be found here You use it like so: if (staminaPotion.isPresent()) { Item pot = staminaPotion.get(); } Or to get the List of all stamina potions in the bank, sorted by dosage: List<Item> staminaPotion = Arrays.stream(getBank().getItems()) .filter(item -> item != null && item.getName().startsWith("Stamina potion")) .sorted(Comparator.comparing(Item::getName)) .collect(Collectors.toList()); This snippet is similar to the above, but instead of returning the min, it instead sorts the Stream using the same Comparator, and then collects the Items into a List -
Detective IHB
-
Explv designer supreme
-
Change the sleep timeout to something longer, such as 10000 ms. There isn't much point using a random timeout like you are doing, and 1.5 seconds probably isn't long enough for the teleport to complete. You should also not just call web walk straight after the teleport. The "Break" interaction could fail, and then your bot will attempt to web walk from wherever your player is standing. What you should do is something like If player is in location where you are teleporting from: Teleport Else: Web walk to the bank Alternatively, like other users have suggested you could create a WebWalkEvent which should handle the teleporting for you. Something like: WebWalkEvent webWalkEvent = new WebWalkEvent(Banks.VARROCK_EAST); PathPreferenceProfile profile = new PathPreferenceProfile(); profile.checkInventoryForItems(true); profile.setAllowTeleports(true); webWalkEvent.setPathPreferenceProfile(profile); execute(webWalkEvent); Apologies for any syntax errors and the formatting, I'm on my phone
-
Don't you want to sleep until you are in Varrock square? I assume you are using a Varrock teleport. Currently you are sleeping until your player is not in Varrock square, which would mean it wouldn't sleep at all.
-
Perhaps you should try sleeping until the teleport has completed, for example sleeping until your player is in the destination area
-
Rekt lmao
-
Good job. I think we already have 6/7 SDN scripts that support Yews though (and more)
-
Probably some time this evening, if not tomorrow
-
Pushed a change, the script will be fixed when the SDN is next updated. Sorry for any inconvenience.
-
Hmm, ok, will take a look after work
-
I will push a fix tonight, some widgets got changed I think and silly me used hardcoded IDs here.
-
Yep think they changed widgets, will update tonight.
-
When you login to OSBot do you use Jeune Padawan as your username? If so, try surrounding it with quotes in the input box: "Jeune Padawan" If that does not work try \"Jeune Padawam\" I don't think my code currently accounts for a space in the username, I will add a fix asap
-
@Tylersbored Like Token said, you should be using .equals() to compare the String values for equality, not ==. For primitives such as int, boolean etc. you use == For non-primitives such as String, Integer you use . equals() because == will only return true if the object references are the same, whereas equals() will compare the values
-
In my opinion, it should be more like: if not is currently trading: if interact "Trade with" on worker is successful: Conditional sleep until is currently trading else if not my offer contains coins: if enter amount dialog is visible: type 35k else if interact "Offer-x" on "Coins" is successful: Conditional sleep until enter amount dialog is visible else if not accepted trade: accept trade Interactions can fail, so you shouldn't continue with other interactions unless you know the first one succeeded. For example, in your code you type 35k after interacting with the Coins, but the Coin interaction might fail (it probably won't), and your bot will just type 35k into the chatbox.
-
Why are you using while loops? Firstly the script is already looping, (the method is even called onLoop) and you also only want to be offering items and accepting trade once. Your code should be structured more like: If not in trade with player then trade player Else if first window and not offered coins then offer coins Else if not accepted trade window accept trade window
-
Should be: -proxy: ip:port or ip:port:username:password
-
It's working for me. It is likely that it cannot find a route to your destination (you can check the log), try walking to somewhere else.
-
getWalking().walk(area) Next time please check the API: https://osbot.org/api/org/osbot/rs07/api/Walking.html https://osbot.org/api/org/osbot/rs07/script/MethodProvider.html#getWalking--
-
You have to call interact(interaction name) on the item returned by getItem
-
With that import you would have to change it to KeyEvent.KEY_TYPED.....