You are viewing our Forum Archives. To view or take place in current topics click here.
#11. Posted:
ShaolinChip
  • TTG Natural
Status: Offline
Joined: Jul 14, 201014Year Member
Posts: 928
Reputation Power: 47
Status: Offline
Joined: Jul 14, 201014Year Member
Posts: 928
Reputation Power: 47
TTGSPIDERMAN wrote Amazing tutorial should be stickied well done mate


Thanks man, I need more thanks on it before I show a mod/admin it though
#12. Posted:
owen509
  • Powerhouse
Status: Offline
Joined: Aug 18, 201014Year Member
Posts: 460
Reputation Power: 19
Status: Offline
Joined: Aug 18, 201014Year Member
Posts: 460
Reputation Power: 19
Great Topic Brendan XD Musta took you a long time .


Another Sticky Worthy one too :sigh:
#13. Posted:
ShaolinChip
  • TTG Natural
Status: Offline
Joined: Jul 14, 201014Year Member
Posts: 928
Reputation Power: 47
Status: Offline
Joined: Jul 14, 201014Year Member
Posts: 928
Reputation Power: 47
owen509 wrote Great Topic Brendan XD Musta took you a long time .


Another Sticky Worthy one too :sigh:


Naa not too long, but thanks. It's what people like, short and simple
#14. Posted:
xD_IOwnedYou_Dx
  • TTG Master
Status: Offline
Joined: Jan 28, 201113Year Member
Posts: 835
Reputation Power: 44
Status: Offline
Joined: Jan 28, 201113Year Member
Posts: 835
Reputation Power: 44
ShaolinChip wrote
Dezyr wrote Can u give me the one that collects the clay please?


import org.rsbot.event.events.ServerMessageEvent;
import org.rsbot.event.listeners.PaintListener;
import org.rsbot.event.listeners.ServerMessageListener;
import org.rsbot.script.Script;
import org.rsbot.script.ScriptManifest;
import org.rsbot.script.methods.Objects;
import org.rsbot.script.methods.Skills;
import org.rsbot.script.wrappers.RSArea;
import org.rsbot.script.wrappers.RSObject;



How do I save this to use for myself? Im alittle Newbie :p
import org.rsbot.script.wrappers.RSTile;
import java.awt.*;
import javax.imageio.ImageIO;
import java.io.IOException;
import java.net.URL;
// M A N I F E S T
@ScriptManifest(authors = { "Deividas" }, keywords = { "Clay", "Miner", "by", "Deividas" }, name = "DvDMiner", description = "Clay Miner by Deividas. Start in varrock west bank", version = 1.1)
public class DvDMiner extends Script implements PaintListener,
ServerMessageListener {
// V A R I A B L E S
private int clayRock[] = { 15505, 15503, 9711, 9713 };
private int pick[] = { 1265, 1269, 1267, 1273, 1271, 1275, 15259 };
private int clayOre = 434;
private int booth = 5912;

int startXP;
int currentXP;
int expGained;
int rocksMined;
int itemPrice;
int profitMade;



RSTile[] bankToMine = new RSTile[] { new RSTile(3182, 3436),
new RSTile(3185, 3431), new RSTile(3179, 3428),
new RSTile(3172, 3426), new RSTile(3171, 3419),
new RSTile(3171, 3413), new RSTile(3171, 3405),
new RSTile(3172, 3398), new RSTile(3172, 3398),
new RSTile(3174, 3390), new RSTile(3177, 3383),
new RSTile(3182, 3380), new RSTile(3184, 3374),
new RSTile(3180, 3371) };
RSArea atBank = new RSArea(new RSTile(3182, 3433), new RSTile(3189, 3446));
RSArea atMine = new RSArea(new RSTile(3169, 3361), new RSTile(3190, 3381));

private final Color color1 = new Color(51, 51, 51, 230);
private final Color color2 = new Color(0, 0, 0);
private final Color color3 = new Color(255, 255, 51);
private final BasicStroke stroke1 = new BasicStroke(1);
private final Font font1 = new Font("Batang", 1, 14);
private final Font font2 = new Font("Batang", 1, 12);


private final Image img1 = getImage("http://blueknights.weblahko.sk/mining_skillcape.gif");
private final Image img2 = getImage("http://dev.imedconsulting.com/shared...lock_small.png");
private final Image img3 = getImage("http://www.runescape.com/img/main/kb...ore/clay_1.gif");
private final Image img4 = getImage("http://www.runescape.com/img/main/kb...ining_icon.gif");
private final Image img5 = getImage("http://images4.wikia.nocookie.net/__...00/Coins_5.png");


public long startTime = System.currentTimeMillis();



public boolean onStart() {
startXP = skills.getCurrentExp(skills.MINING);
itemPrice = grandExchange.getMarketPrice(clayOre);
log("The price of clay is:" +itemPrice);



return true;
}
// Method By BTOdell951
private boolean isInArea(RSArea... areas) {
for (RSArea area : areas) {
if (area.contains(getMyPlayer().getLocation()))
return true;
}
return false;
}

public boolean walkToMine() {

walking.walkPathMM(bankToMine, 2, 2);

return true;


}

public boolean walkToBank() {

walking.walkPathMM(walking.reversePath(bankToMine), 2, 2);

return true;
}

public void mine() {
if(getMyPlayer().isIdle()) {
RSObject obj = objects.getNearest(clayRock);
if(obj != null && getMyPlayer().getAnimation() == -1)
obj.doAction("Mine");
sleep(1000);
}

}


private void bank() {
if(isInArea(atBank) && inventory.isFull())
bank.open();
if(bank.isOpen() && inventory.getCount(clayOre) > 0) {
sleep(random(500, 750));
if (inventory.containsOneOf(pick)) {
if (bank.depositAllExcept(pick))
sleep(random(500, 750));
} else {
if (bank.depositAll())
sleep(random(500, 750));
}
}

}
public void startRunning() {

if (walking.getEnergy() >= 40 && !walking.isRunEnabled()) {
walking.setRun(true);
sleep(random(500, 750));
}
}



private final RenderingHints antialiasing = new RenderingHints(
RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
private Image getImage(String url) {
try {
return ImageIO.read(new URL(url));
} catch(IOException e) {
return null;
}
}

public void onRepaint(Graphics g1) {
currentXP = skills.getCurrentExp(skills.MINING);

Graphics2D g = (Graphics2D)g1;
g.setRenderingHints(antialiasing);

long millis = System.currentTimeMillis() - startTime;
long hours = millis / (1000 * 60 * 60);
millis -= hours * (1000 * 60 * 60);
long minutes = millis / (1000 * 60);
millis -= minutes * (1000 * 60);
long seconds = millis / 1000;

profitMade = rocksMined * itemPrice;
expGained = currentXP - startXP;

g.setColor(color1);
g.fillRect(4, 339, 348, 121);
g.setColor(color2);
g.setStroke(stroke1);
g.drawRect(4, 339, 348, 121);
g.setFont(font1);
g.setColor(color3);
g.drawString("Clay Miner by Deividas", 65, 356);
g.drawImage(img1, 267, 314, null);
g.drawImage(img2, 12, 369, null);
g.setFont(font2);
g.drawString("Time Running:"+ hours + ": " + minutes + ": " + seconds, 42, 383);
g.drawImage(img3, 7, 384, null);
g.drawString("Clay Mined:" + rocksMined, 45, 406);
g.drawImage(img4, 9, 409, null);
g.setColor(color2);
g.drawLine(761, 28, 761, 28);
g.setColor(color3);
g.drawString("Experience Gained:" +expGained, 42, 430);
g.drawImage(img5, 14, 445, null);
g.drawString("Money Made:" + profitMade, 46, 454);
}

public int loop() {
startRunning();
if(!inventory.isFull() && !isInArea(atMine)) {
walkToMine();
} else if (!inventory.isFull() && isInArea(atMine)){
mine();
} else if (inventory.isFull() && !isInArea(atBank)) {
walkToBank();
} else if (inventory.isFull() && isInArea(atBank)){
bank();
}
return random(500,300);
}


public void serverMessageRecieved(ServerMessageEvent e) {
String msg = e.getMessage();
if (msg.contains("You manage to mine"))
rocksMined++;
}
}


thats the code, Save it as DvDMiner.java under sorces



How do I Save it? Ima little newbie....
#15. Posted:
ShaolinChip
  • TTG Natural
Status: Offline
Joined: Jul 14, 201014Year Member
Posts: 928
Reputation Power: 47
Status: Offline
Joined: Jul 14, 201014Year Member
Posts: 928
Reputation Power: 47
xD_IOwnedYou_Dx wrote
ShaolinChip wrote
Dezyr wrote Can u give me the one that collects the clay please?


import org.rsbot.event.events.ServerMessageEvent;
import org.rsbot.event.listeners.PaintListener;
import org.rsbot.event.listeners.ServerMessageListener;
import org.rsbot.script.Script;
import org.rsbot.script.ScriptManifest;
import org.rsbot.script.methods.Objects;
import org.rsbot.script.methods.Skills;
import org.rsbot.script.wrappers.RSArea;
import org.rsbot.script.wrappers.RSObject;



How do I save this to use for myself? Im alittle Newbie :p
import org.rsbot.script.wrappers.RSTile;
import java.awt.*;
import javax.imageio.ImageIO;
import java.io.IOException;
import java.net.URL;
// M A N I F E S T
@ScriptManifest(authors = { "Deividas" }, keywords = { "Clay", "Miner", "by", "Deividas" }, name = "DvDMiner", description = "Clay Miner by Deividas. Start in varrock west bank", version = 1.1)
public class DvDMiner extends Script implements PaintListener,
ServerMessageListener {
// V A R I A B L E S
private int clayRock[] = { 15505, 15503, 9711, 9713 };
private int pick[] = { 1265, 1269, 1267, 1273, 1271, 1275, 15259 };
private int clayOre = 434;
private int booth = 5912;

int startXP;
int currentXP;
int expGained;
int rocksMined;
int itemPrice;
int profitMade;



RSTile[] bankToMine = new RSTile[] { new RSTile(3182, 3436),
new RSTile(3185, 3431), new RSTile(3179, 3428),
new RSTile(3172, 3426), new RSTile(3171, 3419),
new RSTile(3171, 3413), new RSTile(3171, 3405),
new RSTile(3172, 3398), new RSTile(3172, 3398),
new RSTile(3174, 3390), new RSTile(3177, 3383),
new RSTile(3182, 3380), new RSTile(3184, 3374),
new RSTile(3180, 3371) };
RSArea atBank = new RSArea(new RSTile(3182, 3433), new RSTile(3189, 3446));
RSArea atMine = new RSArea(new RSTile(3169, 3361), new RSTile(3190, 3381));

private final Color color1 = new Color(51, 51, 51, 230);
private final Color color2 = new Color(0, 0, 0);
private final Color color3 = new Color(255, 255, 51);
private final BasicStroke stroke1 = new BasicStroke(1);
private final Font font1 = new Font("Batang", 1, 14);
private final Font font2 = new Font("Batang", 1, 12);


private final Image img1 = getImage("http://blueknights.weblahko.sk/mining_skillcape.gif");
private final Image img2 = getImage("http://dev.imedconsulting.com/shared...lock_small.png");
private final Image img3 = getImage("http://www.runescape.com/img/main/kb...ore/clay_1.gif");
private final Image img4 = getImage("http://www.runescape.com/img/main/kb...ining_icon.gif");
private final Image img5 = getImage("http://images4.wikia.nocookie.net/__...00/Coins_5.png");


public long startTime = System.currentTimeMillis();



public boolean onStart() {
startXP = skills.getCurrentExp(skills.MINING);
itemPrice = grandExchange.getMarketPrice(clayOre);
log("The price of clay is:" +itemPrice);



return true;
}
// Method By BTOdell951
private boolean isInArea(RSArea... areas) {
for (RSArea area : areas) {
if (area.contains(getMyPlayer().getLocation()))
return true;
}
return false;
}

public boolean walkToMine() {

walking.walkPathMM(bankToMine, 2, 2);

return true;


}

public boolean walkToBank() {

walking.walkPathMM(walking.reversePath(bankToMine), 2, 2);

return true;
}

public void mine() {
if(getMyPlayer().isIdle()) {
RSObject obj = objects.getNearest(clayRock);
if(obj != null && getMyPlayer().getAnimation() == -1)
obj.doAction("Mine");
sleep(1000);
}

}


private void bank() {
if(isInArea(atBank) && inventory.isFull())
bank.open();
if(bank.isOpen() && inventory.getCount(clayOre) > 0) {
sleep(random(500, 750));
if (inventory.containsOneOf(pick)) {
if (bank.depositAllExcept(pick))
sleep(random(500, 750));
} else {
if (bank.depositAll())
sleep(random(500, 750));
}
}

}
public void startRunning() {

if (walking.getEnergy() >= 40 && !walking.isRunEnabled()) {
walking.setRun(true);
sleep(random(500, 750));
}
}



private final RenderingHints antialiasing = new RenderingHints(
RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
private Image getImage(String url) {
try {
return ImageIO.read(new URL(url));
} catch(IOException e) {
return null;
}
}

public void onRepaint(Graphics g1) {
currentXP = skills.getCurrentExp(skills.MINING);

Graphics2D g = (Graphics2D)g1;
g.setRenderingHints(antialiasing);

long millis = System.currentTimeMillis() - startTime;
long hours = millis / (1000 * 60 * 60);
millis -= hours * (1000 * 60 * 60);
long minutes = millis / (1000 * 60);
millis -= minutes * (1000 * 60);
long seconds = millis / 1000;

profitMade = rocksMined * itemPrice;
expGained = currentXP - startXP;

g.setColor(color1);
g.fillRect(4, 339, 348, 121);
g.setColor(color2);
g.setStroke(stroke1);
g.drawRect(4, 339, 348, 121);
g.setFont(font1);
g.setColor(color3);
g.drawString("Clay Miner by Deividas", 65, 356);
g.drawImage(img1, 267, 314, null);
g.drawImage(img2, 12, 369, null);
g.setFont(font2);
g.drawString("Time Running:"+ hours + ": " + minutes + ": " + seconds, 42, 383);
g.drawImage(img3, 7, 384, null);
g.drawString("Clay Mined:" + rocksMined, 45, 406);
g.drawImage(img4, 9, 409, null);
g.setColor(color2);
g.drawLine(761, 28, 761, 28);
g.setColor(color3);
g.drawString("Experience Gained:" +expGained, 42, 430);
g.drawImage(img5, 14, 445, null);
g.drawString("Money Made:" + profitMade, 46, 454);
}

public int loop() {
startRunning();
if(!inventory.isFull() && !isInArea(atMine)) {
walkToMine();
} else if (!inventory.isFull() && isInArea(atMine)){
mine();
} else if (inventory.isFull() && !isInArea(atBank)) {
walkToBank();
} else if (inventory.isFull() && isInArea(atBank)){
bank();
}
return random(500,300);
}


public void serverMessageRecieved(ServerMessageEvent e) {
String msg = e.getMessage();
if (msg.contains("You manage to mine"))
rocksMined++;
}
}


thats the code, Save it as DvDMiner.java under sorces



How do I Save it? Ima little newbie....


[ Register or Signin to view external links. ] its a direct link to powerbot.org it will tell you how
#16. Posted:
Discretions
  • Challenger
Status: Offline
Joined: Dec 15, 201013Year Member
Posts: 150
Reputation Power: 5
Status: Offline
Joined: Dec 15, 201013Year Member
Posts: 150
Reputation Power: 5
Great post man! Keep em' coming.
#17. Posted:
TheBoatBoss
  • TTG Contender
Status: Offline
Joined: Mar 26, 201014Year Member
Posts: 3,570
Reputation Power: 174
Status: Offline
Joined: Mar 26, 201014Year Member
Posts: 3,570
Reputation Power: 174
Nice post man, Plus Rep.
#18. Posted:
Canning87
  • TTG Commander
Status: Offline
Joined: May 17, 201014Year Member
Posts: 6,839
Reputation Power: 311
Status: Offline
Joined: May 17, 201014Year Member
Posts: 6,839
Reputation Power: 311
Dude, where have you been hiding :O

Liking the post though, sticky ? should be
#19. Posted:
ShaolinChip
  • TTG Natural
Status: Offline
Joined: Jul 14, 201014Year Member
Posts: 928
Reputation Power: 47
Status: Offline
Joined: Jul 14, 201014Year Member
Posts: 928
Reputation Power: 47
EmoSasuke wrote Dude, where have you been hiding :O

Liking the post though, sticky ? should be


I have not been hiding.. although last time we talked was newyears... good night (Y)
#20. Posted:
TTG_DIGITAL
  • V5 Launch
Status: Offline
Joined: May 01, 201014Year Member
Posts: 3,056
Reputation Power: 148
Status: Offline
Joined: May 01, 201014Year Member
Posts: 3,056
Reputation Power: 148
Thanks dude this has helped me alot!
Jump to:
You are viewing our Forum Archives. To view or take place in current topics click here.