Examples of RSComponent


Examples of org.rsbot.script.wrappers.RSComponent

    return game.isLoggedIn() && objects.getNearest(bookPiles) != null;
  }

  @Override
  public int loop() {
    RSComponent talkComponent = interfaces.getComponent(241, 4);
    if (!activateCondition() && readyToLeave) {
      return -1;
    }
    if (getMyPlayer().getAnimation() != -1 || getMyPlayer().isMoving()) {
      return random(500, 1000);
    }
    if (readyToLeave) {
      final RSObject portal = objects.getNearest(PORTAL_ID);
      if (portal != null) {
        final RSTile portalLocation = portal.getLocation();
        if (portal.isOnScreen()) {
          portal.interact("Enter");
          return random(3000, 4000);
        } else {
          walking.walkTileMM(portalLocation.randomize(2, 2));
          return random(1500, 2000);
        }
      }
    }
    if (talkComponent.containsText("Ahem, ")) {
      readyToLeave = false;
    }
    if (talkComponent.containsText("Correct.") || talkComponent.containsText("You can go now.")) {
      readyToLeave = true;
    }
    if (interfaces.getComponent(184, 0).isValid()) {
      final int modelID = interfaces.getComponent(184, 8).getComponent(3).getModelID();
      String itemName = null;
      for (int i = 0; i < MODEL_IDS.length; i++) {
        if (MODEL_IDS[i] == modelID) {
          itemName = ITEM_NAMES[i];
        }
      }
      if (itemName == null) {
        log("The object couldn't be identified! ID: " + modelID);
        if (failCount++ > 10) {
          stopScript(false);
          return -1;
        }
        return random(1000, 2000);
      }
      for (int j = 0; j < 3; j++) {
        final RSComponent iface = interfaces.getComponent(184, 8).getComponent(j);
        if (iface.containsText(itemName)) {
          iface.doClick();
          return random(1000, 1200);
        }
      }
    }
    if (interfaces.canContinue()) {
View Full Code Here

Examples of org.rsbot.script.wrappers.RSComponent

   * Dismisses the familiar from the summoning tab.
   *
   * @return <tt>true</tt> if the familiar was dismissed.
   */
  public boolean doDismiss() {
    RSComponent confirmInterface = methods.interfaces.getComponent(228, 2);
    if (confirmInterface.isValid()) {
      return confirmInterface.doClick();
    } else {
      RSComponent dismissInterface = methods.interfaces.getComponent(INTERFACE_TAB_SUMMONING, INTERFACE_TAB_SUMMONING_CHILD);
      if (dismissInterface != null && dismissInterface.interact("Dismiss")) {
        sleep(random(500, 750));
      }
    }
    return false;
  }
View Full Code Here

Examples of org.rsbot.script.wrappers.RSComponent

    try {
      final org.rsbot.client.RSInterface mm = methods.gui.getMinimapInterface();
      if (mm == null) {
        return new Point(-1, -1);
      }
      final RSComponent mm2 = methods.interfaces.getComponent(mm.getID());
      final int actDistSq = calculatedX * calculatedX + calculatedY * calculatedY;
      final int mmDist = 10 + Math.max(mm2.getWidth() / 2, mm2.getHeight() / 2);
      if (mmDist * mmDist >= actDistSq) {
        int angle = 0x3fff & (int) methods.client.getMinimapAngle();
        if (methods.client.getMinimapSetting() != 4) {
          angle = 0x3fff & methods.client.getMinimapOffset() + (int) methods.client.getMinimapAngle();
        }
        int cs = Calculations.SIN_TABLE[angle];
        int cc = Calculations.COS_TABLE[angle];
        if (methods.client.getMinimapSetting() != 4) {
          final int fact = 256 + methods.client.getMinimapScale();
          cs = 256 * cs / fact;
          cc = 256 * cc / fact;
        }
        final int calcCenterX = cc * calculatedX + cs * calculatedY >> 15;
        final int calcCenterY = cc * calculatedY - cs * calculatedX >> 15;
        final int screenx = calcCenterX + mm2.getAbsoluteX() + mm2.getWidth() / 2;
        final int screeny = -calcCenterY + mm2.getAbsoluteY() + mm2.getHeight() / 2;
        return new Point(screenx, screeny);
      }
    } catch (final NullPointerException ignored) {
    }

View Full Code Here

Examples of org.rsbot.script.wrappers.RSComponent

      return -1;
    }
    try {
      if (canContinue()) {
        if (!talkedToHerald) {
          final RSComponent heraldTalkComp = interfaces.getComponent(242, 4);
          talkedToHerald = heraldTalkComp.isValid() && (heraldTalkComp.containsText("crown") || heraldTalkComp.containsText("is still waiting"));
        }
        if (!interfaces.clickContinue()) {
          interfaces.getComponent(65, 6).doClick();
        }
        return random(600, 800);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.