Jump to content

Camaro

Scripter II
  • Posts

    690
  • Joined

  • Last visited

  • Days Won

    1
  • Feedback

    100%

Everything posted by Camaro

  1. At least this isn't as bad as when my brother asked me to make a bot for his friend to buy sneakers...
  2. I found that once I switched to using a proxy, I wouldn't get banned NEARLY as quickly Went from day 1 bans to just over a month until a ban
  3. There is an overarching problem with the way you are designing the script. It isnt mean to go down through the code and execute everything in order. This is how you have it: if (condition) do this if (condition) do this If both conditions result to true, then both actions are performed. IT should, instead, only evaluate one condition to true and perform one action per every time the script loops. This of onLoop as what you want to do in one moment of time based on environmental values at that instance. you should instead do: if (condition) do this else if (condition) do this for example: if (bank is not open) open bank else if (bank is open) deposit logs The first iteration of the loop. the bank is not open. So you open the bank. The next iteration, the bank is open. So you deposit the logs. Inside of each if statement, you can put more if statements to check more conditions, but try to only ever execute one action every time the script loops. After you get the hang of that, you can look into Events to contain certain actions, and execute 'mini onLoops' throughout the script. Edit: after looking at it more, I see that you arent completely ignoring else statements, but the banking function shouldn't be doing everything at once
  4. I actually just submitted a bug describing a similar situation. Are you by chance executing events?
  5. Take a look at this. I religiously implement this in every script as if it was part of the API
  6. I'm creating a framework for one script with multiple tasks. Is it feasible to instantiate a separate event executor to run events?
  7. I did before posting this, so I was asking for confirmation before I did something unnecessary. Thanks
  8. Hi, Im trying to set the webwalker to use teleports and check the bank for items. If I set both of these to true and I am next to a bank when the event is executed, the bot should automatically open the bank and withdraw teleport runes, correct? Or is that only for items such as amulets, rings ect? For reference, I am in Falador west bank trying to webwalk to varrock.
  9. Am I able to give my own custom args when starting the client for use in my scripts? --mycustomarg "arg"
  10. Hey, So I know http://osbot.org/mvc/get will always give you the latest stable release. Is there a static url I can hit for the newest dev release? Thanks.
  11. Hi all, I'm going to implement a method in my script to determine the closest position that would act as a safespot from a monster I am attacking. I don't want to simply define a few that would always work as there may be a closer, more optimal spot. Now before I spend hours attacking monsters from different angles, does anyone know/have the NPC pathfinding algorithm when it is trying to interact with a player? Thanks!
  12. After the first 'if' statement, put 'else if' instead
  13. How come the version on the mainpage is 2.5.41?
  14. Is there any lock-type object specific to Osbot that I can use to help asynchronous Events edit shared variables?
  15. Well its the same position as the one you are standing on. But is it necessary to use webwalking inside of there?
  16. @Override public int onLoop() throws InterruptedException { new ConditionalLoop(bot, 30000) { @Override public int loop() { log("Running"); return 300; } @Override public boolean condition() { return true; } }.start(); return 600; } Just a simple conditional. Goes way past the 30 second timeout It is probably better to use an Event anyway.
  17. I was just searching for something like this #blessed
  18. So when I stop a script in the middle of a ConditionalLoop, the loop will continue well after the script has stopped. I can tell by text strings continually getting posted to the log that I call from inside the loop. [INFO][Bot #1][01/08 11:19:59 PM]: Here [INFO][Bot #1][01/08 11:19:59 PM]: Here [INFO][Bot #1][01/08 11:19:59 PM]: Here [WARN][Bot #1][01/08 11:20:01 PM]: Event executor is taking too long to suspend; terminating now... [ERROR][Bot #1][01/08 11:20:01 PM]: Caught thread death in EventExecutor [INFO][Bot #1][01/08 11:20:01 PM]: Script Copper miner has exited! [INFO][Bot #1][01/08 11:20:43 PM]: Here [INFO][Bot #1][01/08 11:20:43 PM]: Here [INFO][Bot #1][01/08 11:20:44 PM]: Here Are there certain steps I should take to properly stop a script?
  19. if ((CURR_KILL = myPlayer().getInteracting()) != null) { if (CURR_KILL.getHealthPercent() == 0) { List<GroundItem> items = getGroundItems().get(CURR_KILL.getX(), CURR_KILL.getY()); items.removeIf(i -> !i.getName().equals("Bones")); if (Timing.waitCondition(() -> { List<GroundItem> items2 = getGroundItems().get(CURR_KILL.getX(), CURR_KILL.getY()); items2.removeIf(i -> !i.getName().equals("Bones")); return items.size() < items2.size(); }, 5000)) { GroundItem item = getGroundItems().closest(g -> g != null && getMap().canReach(g) && (g.getName().equals("Iron arrow") && g.getPosition().equals(CURR_KILL.getPosition()))); if (item != null) { int count = (int) inventory.getAmount(item.getName()); if (item.interact("Take")) Timing.waitCondition(() -> inventory.getAmount(item.getName()) > count, 3000); } } } } Believe I have perfected this... Keep looping until the monster I am interacting with has zero health. Then save it's position and wait for the bones to appear. Then loot any arrows with that monsters position.
  20. Are there any advantages to using this option instead of multithreading?
  21. More-so just don't want to run around picking up everyone's arrows
  22. Seem to be having better luck with this if (myPlayer().getInteracting() != null) { CURR_KILL = myPlayer().getInteracting(); List<GroundItem> items = getGroundItems().get(CURR_KILL.getX(), CURR_KILL.getY()); items.removeIf(i -> !i.getName().equals("Bones")); if (Timing.waitCondition(() -> { List<GroundItem> items2 = getGroundItems().get(CURR_KILL.getX(), CURR_KILL.getY()); items2.removeIf(i -> !i.getName().equals("Bones")); return items.size() < items2.size(); }, 10000)) { GroundItem item = getGroundItems().closest(g -> g != null && getMap().canReach(g) && (g.getName().equals("Iron arrow") && g.getAmount() > 4 && g.getPosition().equals(CURR_KILL.getPosition()))); if (item != null) { int count = (int) inventory.getAmount(item.getName()); if (item.interact("Take")) { Timing.waitCondition(() -> inventory.getAmount(item.getName()) > count, 3000); } } } } If the player is interacting (fighting) with something, wait until their bones drop. then scan for items.
  23. Consider the following scenario: You are killing monsters around other players who are killing the same monsters with iron arrows. You want to loot the iron arrows dropped by your monsters, but not pick up any other iron arrows on the ground. What is the best way to achieve this? I have written some code, but not sure if this is efficient... if (myPlayer().getInteracting() != null && Timing.waitCondition(() -> myPlayer().getInteracting().getHealthPercent() == 0, 5000)) { LAST_KILL = myPlayer().getInteracting().getPosition(); } else if (!getCombat().isFighting()) { GroundItem item = getGroundItems().closest(g -> g != null && getMap().canReach(g) && (g.getName().equals("Iron arrow") && g.getAmount() > 4 && g.getPosition().equals(LAST_KILL))); if (item != null) { int count = (int) inventory.getAmount(item.getName()); if (item.interact("Take")) { Timing.waitCondition(() -> inventory.getAmount(item.getName()) > count, 3000); } } } Once the monster's health percent, I store that monsters position to a variable. Then I make sure that the ground item's position is the same as the stored position.
  24. Well, every loop, you are opening the combat tab and then opening the inventory tab, going back and forth between the two. You should set it so only on a level up message (the onMessage function) set a boolean for checking attack style, then setting that variable back to false after everything has been checked
  25. Camaro

    Quick-Hopper

    This doesnt seem to want to switch to an F2P world... cant seem to figure out why Edit: sorry, realized that my world list was not organized correctly. Ordering it by world number fixed this
×
×
  • Create New...