Jump to content

gumibearscuz

Members
  • Posts

    6
  • Joined

  • Last visited

  • Feedback

    0%

Profile Information

  • Gender
    Male

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

gumibearscuz's Achievements

Newbie

Newbie (1/10)

1

Reputation

  1. I have a fairly simple script that I was testing and I realized all of my ConditionalSleeps are just timing out. E.g. RS2Widget widget = api.getWidgets.get(270, 14); if (widget != null) { if (widget.interact("Make")) { boolean result = new ConditionalSleep(10000, 16000) { @Override public boolean condition() throws InterruptedException { api.log("Vial amount: " + api.getInventory().getAmount("Vial of water"); api.log("Herb amount: " + api.getInventory().getAmount("Ranarr weed"); return api.getInventory().getAmount("Vial of water") == 0 || api.getInventory().getAmount("Ranarr weed") == 0; } }.sleep(); api.log("ConditionalSleep returned: " + result); } } Results in logging "Vial amount: 14" "Herb amount: 14" "ConditionalSleep returned: false" every time. It doesn't even check the condition more than once.
  2. The idea behind the "Script" class is that it provides a lot of stuff to run your class as a script. This means that your main class should extends Script so it runs but it also means that you shouldn't just have any class extends Script to get access to the OSBot API. One common way to handle this is to pass a MethodProvider to each new object you make like so: BankingClass banker = new BankingClass( (MethodProvider)this ); If this code is run in your main class (that extends Script) then it will construct a BankingClass object and give it the MethodProvider (the script class extends MethodProvider so we can cast the Script up to its parent class, MethodProvider). Now in the BankingClass I can refer to its MethodProvider to access any cool functions. Another way to handle this is to make a class with a static MethodProvider and then updating that from your main class (I recommend looking up how static variables/functions work vs member variables and functions, if this doesn't make a whole lot of sense). Well first off, getWalking() and getBank() have support for most common walking/banking features so you don't necessarily need your own classes for them but you could make them if you want custom/extended functionality. Second, you are getting into design decisions here which honestly is a really hard part of programming. I cannot simply teach you the best way to design and layout your project, you generally learn that skill through trial and error. The way I would think about it (not saying this is the best/cleanest way, simply what I personally would do) is make a task/node based script where you have different nodes/tasks for each of these things instead of classes that extend things. E.g. you want to make a mining script: task1 = mineOres, task2 = dropOres. And then add whatever code specific to mining an ore or dropping an ore in those tasks/nodes.
  3. getDialogues().isPendingContinuation() fails when at one specific part of the start of tutorial island. Steps to recreate: 1) Create account 2) Login 3) Create appearance 4) Talk to "RuneScape Guide" and continue through text 5) Open Settings tab when tutorial wants you to 6) Everything is fucked here. The tutorial wants us to talk to the guide but isPendingContinuation() will always return true here, even when you are not talking to the guide and there is no continue prompt. Once talking to the guide isPendingContinuation() will always return false despite there being a continue text.
  4. Tasks based approaches are nice but I prefer trees. Made a "TreeMember" class and "TreeBranch" and "TreeLeaf" that extend it. A branch has a boolean that validates it and 2 treemembers (one for success, one for failure). The leafs just have a void to execute. This allows me to prevent having to double check conditions in any tasks and gives a lot of freedom for structuring it. E.g. I made a tutorial island script where onLoop() checks what Instructor I am on and then progresses down a tree specfic to that instructor.
  5. If you guys are talking about using reflection instead of injection then that's been around for ages. IBOT had a reflection bot but they got sued during the bot nuke forever ago and shutdown
×
×
  • Create New...