Advertisement
Guest User

Untitled

a guest
Dec 3rd, 2016
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 3.31 KB | None | 0 0
  1. import org.osbot.rs07.api.ui.RS2Widget;
  2. import org.osbot.rs07.script.Script;
  3. import org.osbot.rs07.script.ScriptManifest;
  4. import org.osbot.rs07.utility.ConditionalSleep;
  5.  
  6. import java.util.ArrayList;
  7. import java.util.List;
  8.  
  9. /**
  10.  * Created by Saiyan on 03/12/2016.
  11.  */
  12. @ScriptManifest(version = 0, info ="" , name = "Fletcher", logo = "", author ="Johan" )
  13. public class Titanic extends Script {
  14.  
  15.  
  16.     @Override
  17.     public void onStart() throws InterruptedException {
  18.  
  19.     }
  20.  
  21.     private void useInventoryItems(String item1, String item2) {
  22.         if(getInventory().isItemSelected()) {
  23.             getInventory().getItem(item1).interact("Use");
  24.             new ConditionalSleep(2000) {
  25.                 @Override
  26.                 public boolean condition() {
  27.                     return getWidgets().getWidgetContainingText(306, "Short Bow") != null;
  28.                 }
  29.             }.sleep();
  30.         } else {
  31.             getInventory().getItem(item2).interact("Use");
  32.             new ConditionalSleep(2000) {
  33.                 @Override
  34.                 public boolean condition() {
  35.                     return getInventory().isItemSelected();
  36.                 }
  37.             }.sleep();
  38.         }
  39.     }
  40.  
  41.     private void conditionalSleep(int time, boolean stopCondition) {
  42.         new ConditionalSleep(time) {
  43.             @Override
  44.             public boolean condition() throws InterruptedException {
  45.                 return stopCondition;
  46.             }
  47.         }.sleep();
  48.     }
  49.  
  50.     private void clickContinue() throws InterruptedException {
  51.         RS2Widget widget = getWidgets().getWidgetContainingText("Click here to continue");
  52.  
  53.         if(widget != null && widget.isVisible()) {
  54.             widget.interact();
  55.             sleep(random(250, 750));
  56.         }
  57.     }
  58.  
  59.     @Override
  60.     public int onLoop() throws InterruptedException {
  61.      RS2Widget makex = getWidgets().getWidgetContainingText(306, "Short Bow");
  62.  
  63.      if(!getInventory().contains("Logs")) {
  64.          if(getBank().isOpen()) {
  65.              if(getInventory().isFull()) {
  66.                  getBank().depositAllExcept("Knife");
  67.              } else {
  68.                  getBank().withdraw("Logs", 69);
  69.              }
  70.          } else {
  71.              getBank().open();
  72.          }
  73.      } else {
  74.          if(getDialogues().clickContinue()) {
  75.              clickContinue();
  76.          } else {
  77.              if(getBank().isOpen()) {
  78.                  getBank().close();
  79.              } else {
  80.                  if(!myPlayer().isAnimating()) {
  81.                      if (!getDialogues().inDialogue()) {
  82.                          if (makex == null) {
  83.                              useInventoryItems("Knife", "Logs");
  84.                          } else {
  85.                              makex.interact("Make X");
  86.                              //anyways yea i need to get ready lul cya xD
  87.                              //at least its wurking :P
  88.                              conditionalSleep(5000,getDialogues().inDialogue() && !makex.isVisible());
  89.                          }
  90.                      } else {
  91.                          getKeyboard().typeString("99");
  92.                          conditionalSleep(15_000,getInventory().onlyContains("Shortbow (u)", "Knife"));
  93.                      }
  94.                  }
  95.              }
  96.          }
  97.      }
  98.         return 350;
  99.     }
  100. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement