Jump to content
View in the app

A better way to browse. Learn more.

OSBot :: 2007 OSRS Botting

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

AnonChopNDrop! Anywhere! Last Update: [10/10/13 8:22 p.m.]

Featured Replies

So this script is so that you can go around chopping any type of tree anywhere. The G.U.I is simple! 

 

4Cp8W.png

 

Type in What type of Tree you want to Chop Kind of like this.

 

Examples:

Tree

Oak

Willow

Maple

Yew

Teak

(IDK about the other trees sorry)

 

Now find the Area in which you want to chop the trees! (Example in Spoiler)

Lets say i wanted to chop some tree right here.

4CphI.png

I would have the g.u.i open and move to This spot then click Set NE Tile

4Cpkx.png

Then i would go move to this spot and click Set SW Tile

4Cpol.jpg

Make Sure you have The type of tree typed in like i stated above and Click Start script! It will in my case chop the four trees that are there and then drop the logs then repeat!

 

Updated Log:

Version 1.0: Initial Release
Version 1.0: Fixed Ents for Teak trees
Version 1.1: Fixed the script. Enhanced dropping method to use names.

 

Download Here:

https://www.dropbox.com/s/1k8dv7go7s4eaid/AnonWoodcut.jar

 

Open Source Code Here:

Anonwoodcut


package woodcutting;
 
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
 
import org.osbot.script.Script;
import org.osbot.script.ScriptManifest;
import org.osbot.script.rs2.model.Item;
import org.osbot.script.rs2.model.RS2Object;
import org.osbot.script.rs2.skill.Skill;
import org.osbot.script.rs2.ui.Inventory;
import org.osbot.script.rs2.utility.Area;
 
@ScriptManifest(author = "Anon", name = "AnonChopNDrop", version = 1.1, info = "Chops dem trees")
public class AnonWoodcut extends Script
{
private String[] logNames = {"Logs","Oak logs","Willow logs","Maple logs","Yew logs"};
private String[] treeNames = {"Tree","Oak","Willow","Maple tree","Yew"};
private String[] axesNames = {"Bronze axe","Iron axe","Steel axe","Black axe","Mithril axe","Adamant axe","Rune axe"};
private int[] axesIds = {1351,1349,1353,1355,1357,1359,1361};
 
private int treeAnim = 867;
 
private String treeToUse;
private Area area;
 
private long startTime;
private int startEXP;
private int logsCut;
private String state;
 
 
AnonGUI gui;
 
public void onStart()
{
gui = new AnonGUI(this);
gui.setFrame();
this.client.setMouseSpeed(20);
}
 
public int onLoop() throws InterruptedException
{
if(gui.isWaiting())
{
while(gui.isWaiting())
{sleep(100);}
treeToUse = gui.getTree();
area = new Area(gui.getSWTile().getX(),gui.getSWTile().getY(),gui.getNETile().getX(),gui.getNETile().getY());
startTime = System.currentTimeMillis();
startEXP = client.getSkills().getExperience(Skill.WOODCUTTING);
logsCut = 0;
state = "Started!";
}
switch(getState())
{
case CHOP:
state = "Finding Tree to Chop";
chopTree();
break;
case DROP:
state = "Dropping Logs";
drop();
break;
case CHOPPING:
state = "Chopping a tree";
sleep(100);
break;
case AREA:
state = "We are lost out of area";
this.walk(area.getRandomPosition(0));
break;
}
return 0;
}
 
public void chopTree() throws InterruptedException
{
RS2Object tree = this.closestObjectForName(area, treeToUse);
if(tree != null)
{
if(tree.isVisible())
{
if(tree.getPosition().distance(this.myPosition()) >= 7)
{
this.walk(tree.getPosition());
}
else
{
if(this.client.getMyPlayer().getAnimation() != treeAnim)
{
tree.interact("Chop down");
sleep(2000);
}
}
}
else
{
this.walk(tree);
this.client.moveCameraToEntity(tree);
}
}
else
{
if(this.closestNPCForName("Ent") != null && this.closestNPCForName("Ent").getPosition().distance(this.client.getMyPlayer().getPosition()) <= 1)
this.walk(area.getRandomPosition(0));
}
}
 
public void drop() throws InterruptedException
{
int[] ids = new int[axesNames.length];
Item item;
for(int i = 0; i < axesNames.length; i++)
{
item = client.getInventory().getItemForName(axesNames);
if(item != null)
ids = item.getId();
}
client.getInventory().dropAllExcept(ids);
}
 
public enum State
{
CHOP,DROP,CHOPPING,AREA
}
 
public State getState() throws InterruptedException
{
if(this.client.getInventory().isFull())
return State.DROP;
if(this.client.getMyPlayer().getAnimation() == 867 || this.client.getMyPlayer().isMoving())
return State.CHOPPING;
if(this.closestNPCForName("Ent") != null && this.closestNPCForName("Ent").getPosition().distance(this.client.getMyPlayer().getPosition()) <= 1)
return State.CHOP;
if(this.client.getMyPlayer().getAnimation() == -1)
{
if(area.contains(this.client.getMyPlayer()))
{
if(!this.client.getInventory().isFull())
{
return State.CHOP;
}
else
{
return State.DROP;
}
}
else
{
return State.AREA;
}
}
else
{
if(this.client.getMyPlayer().getAnimation() == treeAnim)
{
return State.CHOPPING;
}
}
return null;
}
 
public void onPaint(Graphics g)
{
       g = (Graphics2D)g;
       g.setColor(new Color(255, 0, 0, 128));
       g.drawRect(245, 340, 250, 117);
       int currentEXP = client.getSkills().getExperience(Skill.WOODCUTTING);
       int expGained = currentEXP - startEXP;
       g.setColor(Color.BLACK);
       g.drawString((new StringBuilder("Time ran: ")).append(format(System.currentTimeMillis() - startTime)).toString(), 245, 355);
       g.drawString((new StringBuilder("State: ")).append(state).toString(), 245, 365);
       g.drawString((new StringBuilder("Logs Cut(p/h): ")).append(logsCut).append(" (").append(getHourlyRate(logsCut)).append(")").toString(), 245, 375);
       g.drawString((new StringBuilder("Woodcutting EXP gained(p/h): ")).append(expGained).append(" (").append(getHourlyRate(expGained)).append(")").toString(), 245, 385);
       g.drawString((new StringBuilder("Version: ")).append(getVersion()).toString(), 245, 395);
}
 
  public int getHourlyRate(int variable)
  {
       return (int)(((double)(variable - 0) * 3600000D) / (double)(System.currentTimeMillis() - startTime));
  }
  
   public String format(long time)
   {
        StringBuilder string = new StringBuilder();
        long totalSeconds = time / 1000L;
        long totalMinutes = totalSeconds / 60L;
        long totalHours = totalMinutes / 60L;
        int seconds = (int)totalSeconds % 60;
        int minutes = (int)totalMinutes % 60;
        int hours = (int)totalHours % 24;
        if(hours > 0)
            string.append((new StringBuilder(String.valueOf(hours))).append("h ").toString());
        if(minutes > 0)
            string.append((new StringBuilder(String.valueOf(minutes))).append("m ").toString());
        string.append((new StringBuilder(String.valueOf(seconds))).append("s").toString());
        return string.toString();
    }
 
    private int getSeconds(long time)
    {
        return (int)((time / 1000L) % 60L);
    }
 
public void onMessage(String message)
{
if(message.contains("You get some"))
logsCut++;
}
 
public void onExit()
{
this.log("Thanks for Using AnonWoodcut. Please report any errors so i may fix them!");
}
}

AnonGUI


package woodcutting;
 
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
 
import javax.swing.*;
 
import org.osbot.script.Script;
import org.osbot.script.rs2.map.Position;
 
public class AnonGUI extends JFrame
{
private JPanel panel = new JPanel();
private JLabel treeTo = new JLabel("Type in below what tree you would like to chop?(not including the tree part) EX: Willow");
private JTextField field = new JTextField();
private JButton swTile = new JButton("Set SW Cornor");
private JButton neTile = new JButton("Set NE Cornor");
private JButton start = new JButton("Start Script");
 
private String tree;
private Position ne;
private Position sw;
 
private Script wood;
 
boolean guiWait = true;
 
public AnonGUI(Script x)
{
wood = x;
}
 
public void setFrame()
{
this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
this.setPreferredSize(new Dimension(525,100));
panel.setPreferredSize(new Dimension(525,100));
field.setPreferredSize(new Dimension(100,25));
 
panel.add(treeTo);
panel.add(field);
panel.add(swTile);
panel.add(neTile);
panel.add(start);
 
swTile.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent arg0)
{
sw = wood.client.getMyPlayer().getPosition();
wood.log("We set the SouthWest Tile to: "+sw);
}
 
});
neTile.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent arg0)
{
ne = wood.client.getMyPlayer().getPosition();
wood.log("We set the Northeast Tile to: "+ne);
}
 
});
 
start.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
tree = field.getText();
guiWait = false;
dispose();
}
 
});
 
this.getContentPane().add(panel);
this.pack();
this.setVisible(true);
}
 
public String getTree()
{
return tree;
}
public Position getNETile()
{
return ne;
}
public Position getSWTile()
{
return sw;
}
public boolean isWaiting()
{
return guiWait;
}
 
 
}

Edited by Anon

  • Author

Can you make it support teaks at Karamja or CW?

Yeah sure i will collect names and ids in a sec

"if(this.client.getMyPlayer().getAnimation() == 867"

 

Use an IDE that auto swaps in your variables you made silly wink.png

Edited by exuals

  • Author

"if(this.client.getMyPlayer().getAnimation() == 867"

 

Use an IDE that auto swaps in your variables you made silly wink.png

Haha i do lol i just didn't bother control+F and find/replace Its w.e.

Does it drop axes if it more than 1 in one inventory? This should support broken axes. Once the axe is broken, it should drop it and use the next axe in its inventory for longer proggies :-)

  • Author

Does it drop axes if it more than 1 in one inventory? This should support broken axes. Once the axe is broken, it should drop it and use the next axe in its inventory for longer proggies :-)

It never gets broken axes ;)

 

But no i believe it won't drop the normal axes so you can have multiple axes

Guest
This topic is now closed to further replies.

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.