Jump to content

pork

Members
  • Posts

    28
  • Joined

  • Last visited

  • Feedback

    0%

Everything posted by pork

  1. Hi, what is the method for checking if an RS2Object is on screen? I previously used isVisible() but it is no longer in the OSBot 2 API. Thanks!
  2. pork

    Blind Walk

    Is the simple task of walking to a tile using OSBot frustrating to anyone else? Maybe I'm using the wrong walking method that everyone else uses but my bots often just stand around when telling it to walk to a tile. I think this is because OSBot will not move if you tell it to walk to a tile that isn't in the loaded area or if the tile is unreachable. I've tried walk(), walkExact(), walkMinimap(), walkMainScreen() and I think they all require a loaded and reachable tile. Is there a reason for this? It's frustrating and I've resorted to using paths for everything which is annoying. I don't know about everyone else, but I'm used to the ability of specifying any tile and having the bot actually move towards it. So here's a simple method that takes a step in the direction of the specified tile even if it's unreachable or unloaded. Using it in the script's loop will cause it to repeatedly take steps until it reaches the destination tile. It walks in a straight line so maybe it's not the best in terms of bot detection. public boolean blindWalk(Position position) { final int STEP_SIZE = 15; Player myPlayer = client.getMyPlayer(); try { if (position.distance(myPlayer.getPosition()) < STEP_SIZE) { return client.moveMouseTo(new MinimapTileDestination(bot, position), false, true, false); } int myX = myPlayer.getX(); int myY = myPlayer.getY(); int posX = position.getX(); int posY = position.getY(); double deltaX = Math.abs(posX - myX); double deltaY = Math.abs(posY - myY); double angle = Math.atan(deltaY / deltaX); int xModifier = posX < myX ? -1 : 1; int yModifier = posY < myY ? -1 : 1; Position newPosition = new Position(myX + (int)(Math.cos(angle) * STEP_SIZE) * xModifier, myY + (int)(Math.sin(angle) * STEP_SIZE) * yModifier, 0); return client.moveMouseTo(new MinimapTileDestination(bot, newPosition), false, true, false); } catch (Exception e) { return false; } }
  3. Witopia. But there is always a chance that any vpn could disconnect or my internet could disconnect and reconnect to runescape before reconnecting to VPN. I need a way to have my bots close if my ip address changes. Changing vpns isn't a solution for me because it can happen on any other one.
  4. EDIT import java.io.BufferedReader; import java.io.InputStreamReader; import java.net.URL; public class IPListener { private static final String MY_IP_URL = "http://my-ip.heroku.com/"; private static final String BAT_TO_RUN = "run.bat"; public static void main(String[] args) throws Exception { BufferedReader reader = new BufferedReader(new InputStreamReader(new URL(MY_IP_URL).openConnection().getInputStream())); String initialIP = reader.readLine(); reader.close(); System.out.println("Initial IP: " + initialIP); System.out.println("Listening for change in IP address..."); while (true) { reader = new BufferedReader(new InputStreamReader(new URL(MY_IP_URL).openConnection().getInputStream())); String currentIP = reader.readLine(); reader.close(); if (!initialIP.equals(currentIP)) { System.out.println("IP changed from " + initialIP + " to " + currentIP); Runtime.getRuntime().exec("cmd /c start " + BAT_TO_RUN); System.out.println(BAT_TO_RUN + " executed."); break; } } } } Came up with this but it spams the website every few milliseconds... they'll prob block me. The file run.bat is executed on IP change so you can put commands in there to kill java.exe or javaw.exe processes.
×
×
  • Create New...