Skip 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.

cutted willow

Featured Replies

i want to have cutted willow : 202 

 

but it wont work for me. 

 g.drawString("Cut : "+ this.cuttedwood , 15, 88);

someone got a code for it.

 

Based on added xp.

Edited by Mocro

  • Author

Wouldn't it be "cut" not "cutted" ?

Happy?

Wouldn't it be "cut" not "cutted" ?

 

It's a variable name - it could be named 'dickcheese' for all we care and it would still work smile.png

 

@OP

 

It's very hard to tell what's wrong with that line without seeing how you're manipulating the variable. Care to post some further code snippets where you change it's value?

 

lemme write some sort of example if you want to do it via exp. a message listener would probably be a better way but exp works too ;p

//global vars
private int woodCut = 0; //ini

//onstart
experienceTracker.startAll();

//global methods
private int getChoppedLogs(int expPerLog) {
    return (experienceTracker.getGainedXp(Skill.WOODCUTTING) / expPerLog);
}

//onpaint method:
graphics.drawString("Logs chopped: " + getChoppedLogs(40), 0, 0);

//where graphics is ur graphics2d, 40 is the exp per log, and 0,0 are the co-ords for string

wrote it in the reply box so sorry if there are any errors

Edited by Apaec

The way I prefer to do inventory tracking is to compare a "last inventory" with the present inventory, and compare the differences. I wrote up some quick, untested code (it's based off my full accounting code, linked at the end). If it doesn't work let me know, but basically you'll call compareItems() whenever you want to be checking for changes in items (aka during woodcutting), and resetItems() whenever you bank.

 

Code is in spoiler:

    // WARNING: Untested code
    
    /** Holds the amount of willows we have cut */
    private int willowsCut = 0;
    /** Holds the last inventory that was compared */
    private Item[] lastInv;
    
    /**
     * Simple getter
     * @return the number of willows cut
     */
    public int getWillowsCut() {
        return willowsCut;
    }
    
    /**
     * Compares your last inventory with the current inventory.
     */
    public void compareItems() {
        if (lastInv == null) {
            lastInv = getInventory().getItems();
            return; // It will be the same, no need to check
        }
        
        String item = "Willow logs";
        Item[] currInv = getInventory().getItems();
        for (int i = 0; i < 28; i++) {
            // Check for the same thing
            if ((currInv[i] == null && lastInv == null)
                    || currInv[i].getName().equals(lastInv[i].getName()))
                continue; // Its the same, continue
            
            if (currInv[i] != null) {
                // We have an item when we didn't
                if (currInv[i].getName().equals(item))
                    willowsCut++; // It was a willow log, ++
            } else {
                // We don't have an item when we did
                if (lastInv[i].getName().equals(item))
                    willowsCut--; // It was a willow log, --
            }
        }
        lastInv = currInv; // Update the inv
    }
    
    /**
     * Run this when the lastInv needs refreshing, aka after banking
     */
    public void resetItems() {
        lastInv = getInventory().getItems();
    }

 

And a link to pastebin since there is no syntax coloring here(?): http://pastebin.com/ZUYr6rEH

Edit: There is, but I'll leave this here regardless

 

And here is a link to my full accounting code (sorry its mixed in with the paint). Its used in my API so it won't be the easiest port, but the general idea is there: https://github.com/Lem0ns/OSBotAPI/blob/master/painters/GenericPainter.java#L501

Edited by Lemons

  • Author

It's a variable name - it could be named 'dickcheese' for all we care and it would still work smile.png

 

@OP

 

It's very hard to tell what's wrong with that line without seeing how you're manipulating the variable. Care to post some further code snippets where you change it's value?

 

lemme write some sort of example if you want to do it via exp. a message listener would probably be a better way but exp works too ;p

//global vars
private int woodCut = 0; //ini

//onstart
experienceTracker.startAll();

//global methods
private int getChoppedLogs(int expPerLog) {
    return (experienceTracker.getGainedXp(Skill.WOODCUTTING) / expPerLog);
}

//onpaint method:
graphics.drawString("Logs chopped: " + getChoppedLogs(40), 0, 0);

//where graphics is ur graphics2d, 40 is the exp per log, and 0,0 are the co-ords for string

wrote it in the reply box so sorry if there are any errors

Thanks

 

The way I prefer to do inventory tracking is to compare a "last inventory" with the present inventory, and compare the differences. I wrote up some quick, untested code (it's based off my full accounting code, linked at the end). If it doesn't work let me know, but basically you'll call compareItems() whenever you want to be checking for changes in items (aka during woodcutting), and resetItems() whenever you bank.

 

Code is in spoiler:

    // WARNING: Untested code
    
    /** Holds the amount of willows we have cut */
    private int willowsCut = 0;
    /** Holds the last inventory that was compared */
    private Item[] lastInv;
    
    /**
     * Simple getter
     * @return the number of willows cut
     */
    public int getWillowsCut() {
        return willowsCut;
    }
    
    /**
     * Compares your last inventory with the current inventory.
     */
    public void compareItems() {
        if (lastInv == null) {
            lastInv = getInventory().getItems();
            return; // It will be the same, no need to check
        }
        
        String item = "Willow logs";
        Item[] currInv = getInventory().getItems();
        for (int i = 0; i < 28; i++) {
            // Check for the same thing
            if ((currInv[i] == null && lastInv == null)
                    || currInv[i].getName().equals(lastInv[i].getName()))
                continue; // Its the same, continue
            
            if (currInv[i] != null) {
                // We have an item when we didn't
                if (currInv[i].getName().equals(item))
                    willowsCut++; // It was a willow log, ++
            } else {
                // We don't have an item when we did
                if (lastInv[i].getName().equals(item))
                    willowsCut--; // It was a willow log, --
            }
        }
        lastInv = currInv; // Update the inv
    }
    
    /**
     * Run this when the lastInv needs refreshing, aka after banking
     */
    public void resetItems() {
        lastInv = getInventory().getItems();
    }

 

And a link to pastebin since there is no syntax coloring here(?): http://pastebin.com/ZUYr6rEH

Edit: There is, but I'll leave this here regardless

 

And here is a link to my full accounting code (sorry its mixed in with the paint). Its used in my API so it won't be the easiest port, but the general idea is there: https://github.com/Lem0ns/OSBotAPI/blob/master/painters/GenericPainter.java#L501

awsome

 

off topic, but how did you learn to code? and how long did it take you?

Youtube Java coding allot of people have tuts

It's a variable name - it could be named 'dickcheese' for all we care and it would still work smile.png

 

@OP

 

It's very hard to tell what's wrong with that line without seeing how you're manipulating the variable. Care to post some further code snippets where you change it's value?

 

lemme write some sort of example if you want to do it via exp. a message listener would probably be a better way but exp works too ;p

//global vars
private int woodCut = 0; //ini

//onstart
experienceTracker.startAll();

//global methods
private int getChoppedLogs(int expPerLog) {
    return (experienceTracker.getGainedXp(Skill.WOODCUTTING) / expPerLog);
}

//onpaint method:
graphics.drawString("Logs chopped: " + getChoppedLogs(40), 0, 0);

//where graphics is ur graphics2d, 40 is the exp per log, and 0,0 are the co-ords for string

wrote it in the reply box so sorry if there are any errors

I need the exp to get it automaticly is that possible getChoppedLogs(40),

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

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.