rpatel9
2011-12-17 22:28:13
How Long have You Played Runescape?
7 Year(s)
Are you affilated in anyway with Jagex LTD?
No
Were you Referred to SRL?
What is your general programming knowledge?
C++/started java 5 months ago
Are you a member of any other communities?
x-Mod at codemplosion.com
Used to be a member of powerbot but i left due to the scamming/corruption that the admins were behind.
Tell us about yourself…
Please show us one (or multiple) of your scripts.
7 Year(s)
Are you affilated in anyway with Jagex LTD?
No
Were you Referred to SRL?
What is your general programming knowledge?
C++/started java 5 months ago
Are you a member of any other communities?
x-Mod at codemplosion.com
Used to be a member of powerbot but i left due to the scamming/corruption that the admins were behind.
Tell us about yourself…
From: rpatel9
Well ive only just recently joined the community but i have held two competitions and awarded prizes to the winners, Im 22 years old and i live in Singapore. I love playing rs/wow and i also love playing basketball. Im doing a computing course at NUS. I made my first script a year ago which was a rune crafting (earth runes) script, however it was for a different bot. Ive attached it to this app
Please show us one (or multiple) of your scripts.
import java.awt.Color;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Insets;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.WindowConstants;
@ScriptManifest(authors = { "rpatel9" }, name = "rpatel9'sEarthCrafter", keywords = "Runecrafting}", version = 1.7, description = "Crafts earth runes, start at varrock east bank with tiara equipped.")
public class rpatel9EarthCrafter extends Script implements PaintListener {
// INTS
private int ess = 1436;
private int runes = 557;
private int Ruins = 2455;
private int Altar = 2481;
private int Portal = 7389;
private long startTime = System.currentTimeMillis();
private int gainedXp = 0, startXp = 0, startLvl, currentLvl, lvlsGained,
xpToLvl;
private int bankAmount = 0;
private int Musician = 8700;
private int rest;
private rpatel9CrafterGUI gui;
private int index;
private int essenceUsed = 0;
private int essenceAmount = 0;
private int w = 0;
private int c;
private int countCheck;
private int lastEss = 0;
private int totalEssUsed = 0;
// PATH'S
private RSTile toRuins[] = { new RSTile(3264, 3429),
new RSTile(3279, 3429), new RSTile(3284, 3443),
new RSTile(3289, 3456), new RSTile(3294, 3467),
new RSTile(3304, 3473) };
private RSTile toBank[] = { new RSTile(3298, 3462), new RSTile(3290, 3453),
new RSTile(3286, 3439), new RSTile(3275, 3429),
new RSTile(3261, 3428), new RSTile(3252, 3421) };
private RSTile toAltar = new RSTile(2657, 4839);
private RSTile toPortal = new RSTile(2656, 4830);
private RSTile toMusician = new RSTile(3290, 3455);
// RS AREA
private RSArea inRuins = new RSArea(2650, 4826, 2666, 4850);
private RSArea atRuins = new RSArea(3303, 3471, 3308, 3476);
private RSArea atMusician = new RSArea(3287, 3451, 3295, 3459);
// SCRIPT START
// Onstart
public boolean onStart() {
if (game.isLoggedIn()) {
gui = new rpatel9CrafterGUI();
gui.setVisible(true);
while(!gui.isReady){
sleep(50);}
if (index == 0) {
rest = 1;}
else if (index == 1) {
rest = 2;}
gui.dispose();
startLvl = (skills.getCurrentLevel(Skills.RUNECRAFTING));}
return true;
}
// Loop
public int loop() {
bank();
if (rest == 1) {
toRuinsON();}
if (rest == 2) {
toRuinsOFF();}
goInRuins();
craft();
goOutRuins();
if (rest == 1) {
ToBankON();}
if (rest == 2) {
ToBankOFF();}
return 0;
}
// Methods
public void bank() {
mouse.setSpeed(random(4, 6));
if (!bank.isOpen() && !inventory.contains(ess)) {
bank.open();
sleep(800);
}
if (!bank.isOpen() && w == 0) {
bank.open();
sleep(800);
}
if (bank.isOpen() && w == 0 && inventory.containsOneOf(ess, runes)) {
bank.depositAll();
sleep(1500);
}
if (bank.isOpen() && !inventory.contains(ess)) {
bank.depositAll();
sleep(650);
bankAmount = (bank.getCount(runes));
if (w == 0) {
essenceAmount = bank.getCount(ess);}
if (!inventory.isFull()) {
bank.withdraw(ess, 0);
w++;}
sleep(500);
}
if (bank.isOpen() && inventory.contains(ess) && w != 0) {
mouse.setSpeed(5); {
bank.close(); }
sleep(500);
}
}
public void toRuinsOFF() {
mouse.setSpeed(random(4, 6));
if (!bank.isOpen() && inventory.contains(ess) && w != 0) {
sleep(500);
Run();
walking.walkPathMM(toRuins);
}
}
public void toRuinsON() {
mouse.setSpeed(random(4, 6));
if (inventory.contains(ess) && w != 0) {
sleep(500);
if (atMusician.contains(getMyPlayer().getLocation())) {
sleep(500);
if (walking.getEnergy() <35) {
walking.walkTileMM(toMusician);
sleep(500);
RSNPC musician = npcs.getNearest(Musician);
musician.doAction("Listen-to");}
sleep(4000);
if (walking.getEnergy() >35 && getMyPlayer().getAnimation() == -1) {
Run();
walking.walkPathMM(toRuins);
}}
if (getMyPlayer().getAnimation() != -1 && walking.getEnergy() <95) {
sleep(100);
}
if (getMyPlayer().getAnimation() != -1 && walking.getEnergy() >95) {
Run();
walking.walkPathMM(toRuins);
}
if (!atMusician.contains(getMyPlayer().getLocation())) {
Run();
walking.walkPathMM(toRuins);
}
}
}
public void goInRuins() {
mouse.setSpeed(5);
if (atRuins.contains(getMyPlayer().getLocation())
&& inventory.contains(ess) && w != 0) {
if (objects.getNearest(Ruins).isOnScreen()) {
objects.getNearest(Ruins).doAction("Enter");
sleep(1000);}
}
}
public void craft() {
mouse.setSpeed(random(5, 7));
if (inventory.contains(ess)
&& inRuins.contains(getMyPlayer().getLocation())) {
countCheck = inventory.getCount(ess);
if (countCheck == 28) {
c = 1;}
if (countCheck != 28) {
lastEss = inventory.getCount(ess);
sleep(500);}
if (!objects.getNearest(Altar).isOnScreen()) {
walking.walkTileMM(toAltar);
sleep(1000);
while (getMyPlayer().isMoving()
&& objects.getNearest(Altar) == null) {
sleep(50);
}
}
if (objects.getNearest(Altar) != null) {
RSObject altar = objects.getNearest(Altar);
if (altar.doAction("Craft-rune") && c == 1) {
essenceUsed++; }
sleep(800);
}
}
}
public void goOutRuins() {
mouse.setSpeed(4);
if (inventory.contains(runes) && objects.getNearest(Portal) != null
&& !inventory.contains(ess)) {
walking.walkTileMM(toPortal);
sleep(1000);
}
while (getMyPlayer().isMoving() && objects.getNearest(Portal) == null) {
sleep(50);
}
if (inventory.contains(runes) && objects.getNearest(Portal) != null) {
RSObject portal = objects.getNearest(Portal);
portal.doAction("Enter");
sleep(500);
if (atRuins.contains(getMyPlayer().getLocation())) {
;
}
}
}
public void ToBankOFF() {
mouse.setSpeed(random(4, 6));
if (inventory.contains(runes)
&& !inRuins.contains(getMyPlayer().getLocation())) {
Run();
walking.walkPathMM(toBank);
}
}
public void ToBankON() {
mouse.setSpeed(random(4, 6));
if (inventory.contains(runes)
&& !inRuins.contains(getMyPlayer().getLocation())) {
if (atMusician.contains(getMyPlayer().getLocation())) {
sleep(500);
if (walking.getEnergy() <35) {
walking.walkTileMM(toMusician);
sleep(500);
RSNPC musician = npcs.getNearest(Musician);
musician.doAction("Listen-to");
sleep(4000);
}
if (walking.getEnergy() >35 && getMyPlayer().getAnimation() == -1) {
Run();
walking.walkPathMM(toBank);
}}
if (getMyPlayer().getAnimation() != -1 && walking.getEnergy() <95) {
sleep(100);
}
if (getMyPlayer().getAnimation() != -1 && walking.getEnergy() >95) {
Run();
walking.walkPathMM(toBank);
}
if (!atMusician.contains(getMyPlayer().getLocation())) {
Run();
walking.walkPathMM(toBank);
}
}
}
public void Run() {
if (walking.getEnergy() == 100) {
interfaces.getComponent(750, 6).doAction("Turn run mode on");
sleep(500);}
}
//Onfinish
public void onFinish() {
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;
totalEssUsed = essenceUsed * 28;
log.severe("Ran For: " + hours + " : " + minutes + " : " + seconds + ". ");
log.severe("You Gained: " + gainedXp + " Runecrafting Experience. ");
log.severe("You crafted: " + (totalEssUsed + lastEss) + " Rune Essence");
log.severe("And there are " + (essenceAmount - (totalEssUsed + lastEss)) + " Essence left.");
log.severe("Thank you for using my script!");
}
// PAINT
public void onRepaint(Graphics g) {
if (game.isLoggedIn()) {
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;
long runTime = System.currentTimeMillis() - startTime;
int xpPerHour = 0;
int totalEssUsed = 0;
if (runTime / 1000 > 0) {
xpPerHour = (int) (3600000.0 / runTime * gainedXp);
}
if (startXp == 0) {
startXp = skills.getCurrentExp(Skills.RUNECRAFTING);
}
gainedXp = skills.getCurrentExp(Skills.RUNECRAFTING) - startXp;
currentLvl = skills.getCurrentLevel(Skills.RUNECRAFTING);
xpToLvl = skills.getExpToNextLevel(Skills.RUNECRAFTING);
lvlsGained = currentLvl - startLvl;
totalEssUsed = essenceUsed * 28;
g.setColor(Color.WHITE);
g.setFont(new Font("Segoe Print", Font.PLAIN, 16));
g.drawString("rpatel9EarthCrafter", 10, 60);
g.setFont(new Font("Segoe Print", Font.PLAIN, 12));
g.drawString("There are " + (bankAmount)
+ " Earth Runes in your bank", 10, 100);
g.drawString("We Gained " + gainedXp + "Xp", 10, 120);
g.drawString("In exactly " + hours + " : " + minutes + " : "
+ seconds, 10, 140);
g.drawString("Averaging at " + xpPerHour + "XP each hour!", 10, 160);
g.drawString("Current Lvl " + currentLvl + " (" + lvlsGained + ")", 10,
180);
g.drawString("Experience till " + (currentLvl + 1) + " : " + xpToLvl, 10, 200);
g.drawString("We used " + (totalEssUsed + lastEss) + " Rune Essence", 10, 220);
g.drawString("Essence left:" + (essenceAmount - (totalEssUsed + lastEss)), 10, 240);
}
}
//Gui
public class rpatel9CrafterGUI extends JFrame {
public =rpatel9CrafterGUI() {
initComponents();}
private boolean isReady;
private static final long serialVersionUID = 1L;
private void button1ActionPerformed(ActionEvent e) {
isReady = true;
//panel1.setVisible(false);
index = rest.getSelectedIndex();}
private void initComponents() {
panel1 = new JPanel();
rest = new JComboBox();
startButton = new JButton();
setTitle("rpatel9EarthCrafter");
Container contentPane = getContentPane();
contentPane.setLayout(null);
contentPane.setVisible(true);
{
panel1.setLayout(null);
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
//---- rest ----
rest.setMaximumRowCount(2);
rest.setModel(new DefaultComboBoxModel(new String[] {
"Rest at musician",
"Don't use rest"
}));
rest.setSelectedIndex(0);
rest.setFont(new Font("Segoe Print", Font.PLAIN, 12));
panel1.add(rest);
rest.setBounds(40, 60, 170, 45);
//---- startButton ----
startButton.setFont(new Font("Segoe Print", Font.PLAIN, 12));
startButton.setText("Start!");
panel1.add(startButton);
startButton.setBounds(85, 125, 80, 38);
startButton.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e) {
button1ActionPerformed(e);}});
{ // compute preferred size
Dimension preferredSize = new Dimension();
for(int i = 0; i < panel1.getComponentCount(); i++) {
Rectangle bounds = panel1.getComponent(i).getBounds();
preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
}
Insets insets = panel1.getInsets();
preferredSize.width += insets.right;
preferredSize.height += insets.bottom;
panel1.setMinimumSize(preferredSize);
panel1.setPreferredSize(preferredSize);
}
}
contentPane.add(panel1);
panel1.setBounds(0, 0, 250, 200);
{ // compute preferred size
Dimension preferredSize = new Dimension();
for(int i = 0; i < contentPane.getComponentCount(); i++) {
Rectangle bounds = contentPane.getComponent(i).getBounds();
preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
}
Insets insets = contentPane.getInsets();
preferredSize.width += insets.right;
preferredSize.height += insets.bottom;
contentPane.setMinimumSize(preferredSize);
contentPane.setPreferredSize(preferredSize);
}
pack();
setLocationRelativeTo(getOwner());
}
private JPanel panel1;
private JComboBox rest;
private JButton startButton;
}
}