Package org.rsbot.script.util

Examples of org.rsbot.script.util.Timer


            } else {
              direction = random(0, 2);
            }
            final RSComponent arrow = solver.getComponent(ARROWS[i][direction]);
            while (container.isValid() && target.isValid() && arrow.isValid() &&
                !container.getArea().contains(target.getCenter()) && new Timer(10000).isRunning()) {
              if (arrow.doClick()) {
                sleep(random(800, 1200));
              }
            }
          }
View Full Code Here


   * Moves the camera in a random direction for a given time.
   *
   * @param timeOut The maximum time in milliseconds to move the camera for.
   */
  public void moveRandomly(final int timeOut) {
    final Timer timeToHold = new Timer(timeOut);
    final int highest = random(75, 100);
    final int lowest = random(0, 25);
    final int vertical = Math.random() < Math.random() ? KeyEvent.VK_UP : KeyEvent.VK_DOWN;
    final int horizontal = Math.random() < Math.random() ? KeyEvent.VK_LEFT : KeyEvent.VK_RIGHT;
    boolean verticalKeyDown = false;
    boolean horizontalKeyDown = false;
    if (random(0, 10) < 8) {
      methods.inputManager.pressKey((char) vertical);
      verticalKeyDown = true;
    }
    if (random(0, 10) < 8) {
      methods.inputManager.pressKey((char) horizontal);
      horizontalKeyDown = true;
    }
    while (timeToHold.isRunning() && (verticalKeyDown || horizontalKeyDown)) {
      if (getPitch() >= highest && vertical == KeyEvent.VK_UP ||
          getPitch() <= lowest && vertical == KeyEvent.VK_DOWN) {
        methods.inputManager.releaseKey((char) vertical);
        verticalKeyDown = false;
      }
View Full Code Here

      return true;
    }
    if (methods.game.openTab(Game.Tab.ATTACK)) {
      final RSComponent button = methods.interfaces.getComponent(884, styleIndex + 11);
      if (button != null && button.doClick(true)) {
        final Timer timer = new Timer(800);
        while (timer.isRunning() && getFightMode() != styleIndex) {
          sleep(50);
        }
        return getFightMode() == styleIndex;
      }
    }
View Full Code Here

      }
    }
    if (game.getClientState() == Game.INDEX_LOGGING_IN && account.getName().equalsIgnoreCase(AccountStore.FACEBOOK_ACCOUNT.getUsername())) {
      if (interfaces.getComponent(INTERFACE_LOGIN_SCREEN, INTERFACE_LOGIN_SCREEN_ALERT_TEXT).getText().toLowerCase().trim().contains("logging in - please wait")) {
        log.info("Waiting for facebook connection");
        Timer t = new Timer(timeout);
        while (t.isRunning() && game.getClientState() == Game.INDEX_LOGGING_IN) {
          sleep(100);
        }
        if (game.getClientState() == Game.INDEX_LOGGING_IN) {
          return interfaces.getComponent(INTERFACE_LOGIN_SCREEN, INTERFACE_LOGIN_SCREEN_ABORT_LOGIN).doClick() ? 500 : 0;
        }
View Full Code Here

TOP

Related Classes of org.rsbot.script.util.Timer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.