Jump to content

BravoTaco

Scripter II
  • Posts

    237
  • Joined

  • Last visited

  • Feedback

    100%

Everything posted by BravoTaco

  1. To get scripter 1 rank you have to apply for it and have a script that is in development or is ready to be put up on the sdn. Go here and read the threads to learn more about the requirements and the process to take to apply. https://osbot.org/forum/forum/181-sdn-requests/ Happy scripting Also feel free to pm me if you have any questions throughout your scripting journey.
  2. I would recommend not calling the interact() in the same call as getItem() as it could throw an NPE. Anyways you can try this if the first action is the one you always want to use. Item invItem = getInventory().getItem("ItemName"); if (invItem != null) { String[] actions = invItem.getActions(); if (actions != null) invItem.interact(actions[0]); }
  3. Hmmm, you could create a wrapper for when you use the interact() method, so when the interact() returns true than you know it clicked. EX. Might cause problems if the bot had to right click to interact with it though. private Point interact(Entity entity) { Point clickedPoint = null; if (entity.interact()) clickedPoint = getMouse().getPosition(); return clickedPoint; }
  4. In the situation of closing the bank, and moving the mouse to the inventory before the bank is closed or as soon as you click close. You could just use widgets to get the close button, interact with the widget and right after interacting with no sleeps just move the mouse over to whatever inventory slot you want. Than wait until the interface is closed before interacting with the inventory item.
  5. While loops have their place, but with bots you really want to only execute one task/function per loop for safety and performance. If you want to use a while loop I would add a counter to set the maximum number of attempts the code can run. That way the while loop can never get stuck. Also I think Mirror Mode is single threaded, so it could cause issues depending on how and when the values used by the API calls are updated.
  6. https://osbot.org/api/org/osbot/rs07/api/HintArrow.html
  7. I've noticed that if you call a bank method too soon after the first time of opening the bank it will cause unexpected results. Try to add a sleep after opening the bank.
  8. Will need actual code to diagnose why case 1 is not working. As of right now, there is no way to tell what is causing case 1 to fail since the method onLoop() in the CObject class, if statement, does not show the condition. Also if your using a switch system, you should look into Enums to separate the different types of states that your bot will be in. It will make it easier to switch between states since you can set the state based on a series of condition checks. Ex. Declare an Enum with the different states. I'll just use ATTACK, LOOT, BANK states. Than in the main class declare a BotState variable that will hold the current state of the bot. Than create a method that will change the state of the variable in the main class. And add it to the first line of the onLoop() method. Lastly, add the switch statement to the onLoop() method.
  9. Always use getters when its available. Getters and Setters can be doing alot more under the hood than just returning a variable or just setting it to a different value. Take a look at this thread. In it, the settings variable was not returning the correct value of the run energy, but when he switched it to use the getter it worked.
  10. This problem can occur while using the wrong java version when building out the jar. In IntelliJ go to File -> Project Structure -> Project Set the Project SDK to 1.8 Set the Project language level to 8
  11. Try this Entity interacting = myPlayer().getInteracting(); if (interacting != null) { if (interacting instanceof RS2Object) { RS2Object object = (RS2Object) interacting; } else if (interacting instanceof NPC) { NPC npc = (NPC) interacting; } }
  12. Could be the script, but I haven't seen anyone else complain about lag from it. Try another script and see if the lag continues.
  13. What script are you using? Is it self written? Also is the logger printing out any errors?
  14. What are you doing with the returned int value in the run()? Also are you sure that 2 is the correct child id of 808 when the quest is complete?
  15. Is the option visible even when its full? If so you will probably have to use configs than.
  16. Try this, haven't tested it. Item pouch = (Item) Arrays.stream(getInventory().getItems()).filter((i) -> i.getName().contains("pouch") && i.hasAction("Fill")).toArray()[0];
  17. If the code above is the same that you are using and you are trying to access the userChoice variable outside of the onStart() than it will show invalid variable, as you have only created that variable inside of the onStart(). Add the userChoice var to the class and set that value in the onStart(), you will than be able to use that variable.
  18. You can use getDirectoryData() method to retrieve the path to the data folder, so that if you, or someone else has a different install location it will retrieve the correct path.
  19. By not recognizing your option anymore, do you mean that it is returning a value that was not selected? Or is it that the values in the JOptionPane are not the options you are passing into it?
  20. With calling settings you are calling the variable itself with getSettings() you are calling a getter that may be doing more than just returning the variable itself. In most cases calling just settings will work but depending on when and where you are calling the settings variable it’s context could possibly not be the current bot context so it is unable to accurately retrieve the information needed while not throwing any errors. To verify this, print what the current value of that call is, to the console.
  21. As dreameo said singletons are great to use and I recommend that as these classes are being used to execute a task and you would only ever need a single instance of them. As for the error you were getting, this is because of you calling the class name followed by the method. You need to use the variable name followed by the method. IE. Banking banking = new Banking(); banking.method(); Notice the lowercase b. If you use an uppercase than it will reference the class itself.
  22. Might want to flip that operator (; > - greater than < - less than
  23. Could of been a server restart/crash that caused the account to logout than once the bot tried re-logging the bot was unable to since the server was unresponsive at the time, causing the bot to quit the script.
  24. sudo apt-get install openjdk-8-jdk
  25. To my knowledge, you won't be able to override the default mouse movement/interactions within the API so you will have to create custom methods and call those. You wont have to create that many methods as the objects you interact with always have an X, Y position, knowing this you could create a moveMouse(int X, int Y) method that would work for all interactable objects. Than after using your own mouse movement logic to move closely to the object you could than finish off the method with an interaction() call to the API. This may even provide more randomness to the mouse logic since the API will than have a chance to also use its own movement logic to interact with the object.
×
×
  • Create New...