Jump to content

Glaciation96

Members
  • Posts

    76
  • Joined

  • Last visited

  • Feedback

    0%

Profile Information

  • Gender
    Male

Recent Profile Visitors

1013 profile views

Glaciation96's Achievements

Iron Poster

Iron Poster (3/10)

8

Reputation

  1. Hello folks, Could I get some help to understand what is going on in the Sleep class please? I understand that it allows your script to use lambdas when sleeping, and you'll just be calling the static sleepUntil method, which fills out the Sleep constructor and returns its own object method, but my question is; When does the mandate override boolean method condition() get called? It returns the functional method from BooleanSupplier, but I can't seem to follow the code from around this point. Is there perhaps a link between the member variable 'condition' and the override method condition()? It's not just there because it extends ConditionalSleep is it? I'm guessing it's actually doing something.. Any help would be greatly appreciated. I've been stumped by this for around a week now so I thought I had to ask. Many thanks!
  2. Oh, I'm probably misunderstanding what imports are and how they work then lol. It's probably something to do with instantiating a class with/or an interface which enables you to use them then... The Sleep class might have it I guess, just gotta dig through the libraries. Thanks!
  3. Hey there! Hope you're all doing well, but unfortunately, I am back. I'll make it quick this time around:) I'm trying to get into using Lambdas, but I'm a little confused. Is there an import which includes the Sleep method that enables the use of lambdas? I have import org.osbot.rs07.utility.ConditionalSleep; but clearly that isn't it. I just see some people using lambdas in their script, but I'm not seeing the functional interface which is required? Maybe they're not pasting the entirety of their script, but would I have to create my own interface? Just wondering if there was already an osbot import/extension for that, other than the built-in java ones. Cheers!
  4. Howdy, Was an amazing script for the short time that I had it (I'm no longer a member). I liked the display, such as GUI and curser. Made the simple fact of using the bot feel good. It's a late revisit, but I have some minor feedback as I may start playing/botting again soon. From what I've seen, I don't think the bot loot Rannarr seeds does it? They're quite valuable so if it's not a feature yet, I think it would make a good addition! Well, really depends on how rich the people are who use this. I'm poor so it makes a difference to me?
  5. Sorry, I initially thought exchangeContext() was a java method not associated with botting! I managed to research into and understand how to implement it as you've suggested. But exchangeContext() has been deprecated, so no Javadoc could be found. Is there a new or updated approach? I was hoping suppressing the warnings would be a magical way out lol. Thanks! EDIT: Oh wow, even with the line going straight through, the variables still works. Just looks ugly. Thanks for the help, exchangeContext() is a life saver?
  6. Wow. I've just discovered a valuable resource.
  7. Cheers man! very helpful. I'll definitely look into that. Trying to successfully achieve this check through multithreading has been a rocky road lol, but really wanna understand/learn this. EDIT: Damn, I'm not getting any results for exchangeContext(). Is there another term for this method I can search up instead?
  8. Brilliant! I never would have figured that out myself... Just one class in a script can extend Script? I do wonder how people would just know this... Probably a principle for when you extend anything then? But that means I won't be able to use methods such as myPlayer().isAnimating() and the like from within my second class. Guess I've got to call all of that from inside my first class. Thanks! And yes, bad habit, it's good practice to keep checking my code frequently.
  9. I return to this thread in shame, sorry guys. Mission failed. researched into multithreading and it looks like such a powerful tool! Thanks for bringing this up to me, but the struggle is real. Requesting guidance, please! I'll try to make this as easy to answer as possible by going through the logic in my code! Did I at least get close? For context, what I shared are the only changes that I made, in regards to trying to implement multithreading... Also, the bot worked before this, albeit the multiple interactions to fish. When I start the bot, I can't tell what's wrong really... The bot doesn't even do anything and then the client goes incredibly slow, then crashes. I'm guessing it's due to my infinite loop? But isn't that just to keep checking/updating the 1 bool? Since I wrote the code, my snippet looks quite easy to read for me, but obviously, it'll be different for other people. I hope I've made answering this as easy as possible! There could be a couple things wrong, or a million. If it's just a messy pile of mistakes making it too much effort to answer, just let me know. That way at least I know I'm not even close, so instead of making minor changes to try getting this to work, I can just scrap it for a whole new approach to the multithreading issue. Thanks a bunch fellas. EDIT: Improving readability
  10. Thanks for the additional info! I've not given Malcolm's method a go yet as I've just 'completed' my script, so just focused on fixing the minor errors right now before I move onto implementing improvements (like tackling the double interaction properly). I'll definitely want to take a look into what you suggested as well. I made a quick search, and I assume it's called java concurrency and/or multithreading which you're referring to.
  11. So the object class is the super class of all super classes, basically? I never looked into it before, but always assumed that a super class never inherited anything themselves. Guess there are many layers upon layers of this class hierarchy. Your explanation deepened my perspective on java, very informative, thanks! Unfortunately, it's now question time... (sorry lol) I'm sure you've all experienced this before, but when it comes to fishing (and possibly other activities), if you double-click the fishing spot, the player will stop fishing after looping through the fishing animation 3 times (about 5 seconds of fishing), forcing you (or the bot) to click the spot again. If you click it once, it's fine. The character will fish until the spot goes or inv is full. The bot will always double click if you use the standard/basic method, which is obviously 'interact -> conditional sleep'. The bot will always try to interact with the fishing spot a second time as the conditional sleep returns !myPlayer().isAnimating(). But obviously, the character doesn't fish, or initiate the fishing animation as soon as the interaction is made which is the reason. Is adding the general sleep(random(small sleep here)) just before the conditional sleep to return !myPlayer().isAnimating() the only way to bypass the double interaction? The drawback of this for me is that the general sleep time just slows down the onLoop rate for the bot itself. It hurts my script since I rely on the continuous looping to check if there are any free fish on the ground whilst fishing lol. Just wondering if there is a convenient method for improvement on this little drawback, maybe like the conditional sleep returning some secret condition I don't know about If the solution is something like implementing lambdas, just tell me there's no solution lol Yes apa, I took your advice to make use of the continuous onLoop for my second script Thanks fellas!
  12. Yes, it is for shift dropping. That aside, that was a lot of information. Very much appreciated! Constantly checking your bot is a skill lol. I think the way I've structured mine, it'll just break before it gets to the part I'm unsure of, probably, then forcing me to patch up my script in other areas when I'd prefer to finish up what I'm currently working on. I tend to 'finish' the script before running tests, ultimately taking the brunt of all my mistakes at once? Should definitely get into the habit of being able to test as I go for sure though. Thanks for the help!
  13. Guess who's back? Got a quick one this time getKeyboard().pressKey(KeyEvent.VK_SHIFT); for (int i = 0; i < invSlotIndex.length; i++) { Item item = getInventory().getItemInSlot(i); if (item != null && !item.nameContains(levelFishType.getTool())) { //Look in this line //Interact etc } } So I've been working on my second script still, and it's nowhere near 'testing ready', which makes knowing if certain methods from the API actually do what I THINK they do. It's more difficult to get the answer if no one has covered the method in the forums. So I guess the question is, have you ever used item.nameContains() before? Does it simply grab the names of items like a sort of filter? I'm trying to drop items in a randomised fashion by grabbing the index of inventory slots, then proceeding to drop the item in that slot IF it's not something important like my Lobster pot. This is stated in my String[] named levelFishType.getTool(). I've already tried: item.getName().equals(levelFishType.getTool()) But it's giving me this error: Unlikely argument type for equals(): String[] seems to be unrelated to String Which is rather strange, unless .equals only strictly take strings and not string arrays. Thanks!
  14. Ahh so it was to do with something in an entirely different aspect of Java, perfect, I'll look into those, cheers!
×
×
  • Create New...