Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)

Paste

Pasted as Plain Text by asd ( 17 years ago )
import java.awt.*;
import java.awt.event.KeyEvent;

import com.speljohan.rsbot.bot.Bot;
import com.speljohan.rsbot.event.listeners.PaintListener;
import com.speljohan.rsbot.script.Script;
import com.speljohan.rsbot.script.wrappers.*;
import com.speljohan.rsbot.script.*;

public class EpicNewts extends Script implements PaintListener{
 int randomRun = random(20, 65);
 
RSTile[] bank2newt = new RSTile[]{new RSTile (3092, 3245), new RSTile(3078, 3254),
      new RSTile(3072, 3270), new RSTile(3057, 3276), new RSTile(3041, 3276),
      new RSTile(3027, 3268), new RSTile(3017, 3259), new RSTile(3012, 3260)};
RSTile[] newt2bank = reversePath(bank2newt);
int count;
long startTime;
int newtCount;

 public double getVersion() {
  return(2.0);
 }

 public String getName() {
  return("Epics Newt Buyer");
 }

 public String getAuthor() {
  return("Epics");
 }

 public String getScriptCategory() {
  return("Moneymaking");
 }

 public String getScriptDescription( ) {
  String html = "";

  html += "<html>n";
  html += "<body>n";
  html += "<h2>" + getName() + " v" + getVersion() + "</h2><br>n";
  html += "Author: " + getAuthor() + "<br><br>n";
  html += "Another buyer script ofc... :) Start in draynor either in bank or on way to mage shop in Port Sarim...";
  html += "</body>n";
  html += "</htmln";
  return html;
 }

 public boolean onStart(String[] args) {
  Bot.getEventManager( ).addListener(PaintListener.class, this);
  startTime = System.currentTimeMillis(); // have to have a start time.
  newtCount = 0; 
  log("^_^");
  return true;
 }

 public void onFinish() {
   Bot.getEventManager().removeListener(PaintListener.class, this);
 }

 public int loop() {
  if (getEnergy() >= random(20, 65)) {  
    randomRun = random(20, 65);
   setRun(true);
       setCameraRotation(getCameraAngle() + random(40, 55));
  }
                 if (getMyPlayer().isMoving()) {
                  return random(500, 1000);   
}

                 count = getInventoryCount(); // finds out how many items are in your inventory
 
   RSObject door = findObject(40108);
    if (door != null) {
     if (distanceTo(door) <= 6) {
     atDoor(door, "West", "Open"); // lman, idk. <-- touche
    return random(500, 1000);
    }
    
   }
                 if (count == 28 && distanceTo(bank2newt[0]) > 4) {
                 walkPathMM(randomizePath(newt2bank, 2, 2), 20);  
               return random(250, 500);
               }
                if (count < 28 && distanceTo(newt2bank[0]) > 4) {
                    walkPathMM(randomizePath(bank2newt, 2, 2), 20); 
                    return random(250, 500);
               }
               if (count == 28 && distanceTo(bank2newt[0]) < 4) { 
                   RSObject booth = findObject(2213);
                   if (booth != null) {
                       if (tileOnScreen(booth.getLocation())) {
                       atObject(booth, "Use-quickly");
                       wait(random(300, 600));
            setCameraRotation(getCameraAngle() + random(40, 41));
                   }
              }
                if (RSInterface.getInterface(INTERFACE_BANK).isValid()) {
                   newtCount += getInventoryCount(221);
                   bank.depositAllExcept(995); // 995 is the item id for money
       
                }
                }
    RSNPC shop = getNearestNPCByName("Betty");
                atNPC(shop, "Trade");
                if ( interfaceExists(620) )  {
                clickMouse(391, 107, 2, 2, false ); 
                wait( random(50, 100) );
                atMenu("Buy X"); // Buy X newt
                wait( random(400, 500) );
                buyXAmount(); // buyXAmount ()
            setCameraRotation(getCameraAngle() + random(14, 22));
    }else{
     setMaxAltitude();
     setCameraRotation(getCameraAngle() + random(40, 55));
     }
                return random(1000, 1500);  
                }
 
  private void setMaxAltitude() {
    setCameraAltitude(true);
  }
  public void buyXAmount() {
  int[] oftenUsedInputs = new int[] { 32, 35, 52, 47, 91, 57, 44 }; //oftenUsedInputs
  int buyThisAmount = oftenUsedInputs[random(0, oftenUsedInputs.length)];
  wait( random(500, 700) ); // waits
  sendText("" + buyThisAmount, true); // buyThisamount+enter
}

  @Override
  public void onRepaint(Graphics render) {
   drawStringShadow(render, "Epic Newts", 377, 329);
   int nPh; 
   nPh = ((int) (newtCount * fraction()));  
   drawStringShadow(render, "Newts per hour: " + nPh, 340, 355);
   int Profit = newtCount * 56;
   drawStringShadow(render, "Profit Made:" + Profit, 340, 370);
   long milliSecond = System.currentTimeMillis() - startTime; //Stolen from Gnarly
   final long hours = milliSecond / (1000 * 60 * 60);
   milliSecond -= hours * (1000 * 60 * 60);
   final long minutes = milliSecond / (1000 * 60);
   milliSecond -= minutes * (1000 * 60);
   final long seconds = milliSecond / 1000;
   drawStringShadow(render, "Runtime: " + hours + ":" + minutes + ":" + seconds + "", 340, 385);
  }

 private double fraction(){ 
   
   if(timeRunning() <= 1000){
    return 0.0; 
   }
   
   return ((1000 * 60 * 60) / timeRunning());  
  }
 public long timeRunning(){
  return System.currentTimeMillis() - startTime;
 }

  private void drawStringShadow(Graphics render, String string, int x, int y){
   render.setColor(Color.BLUE);
   render.drawString(string, x-1, y-1);
   render.setColor(Color.WHITE); // insert text colour here.
   render.drawString(string, x, y);
  }
        
 
}

 

Revise this Paste

Your Name: Code Language: