Jump to content
Frequently Asked Questions
  • Are you not able to open the client? Try following our getting started guide
  • Still not working? Try downloading and running JarFix
  • Help! My bot doesn't do anything! Enable fresh start in client settings and restart the client
  • How to purchase with PayPal/OSRS/Crypto gold? You can purchase vouchers from other users
  • OnItemChange buggy? Any Workaround?


    Pegleg

    Recommended Posts

    Hey,

    i dont know why this is not working properly and may you guys have a workaround solution to deal with this.

    The bug is about the Inventorylistener where Items are not changing correctly, if those are the last Items in your Inventory of this kind. This is really annoying and if you make a sleepUntil like

    PlayerAnimation == -1 || getInventory.count(x) == 0 ,you cant log any profit etc..

    Ok. To Test this i made a simple script, which just has the InventoryListener implemented (i did the 10000 ms waiting to simulate a SleepUntil):

    (All text is inside the Spoiler, i failed to create a good one and cant fix it in EDIT mode. Sorry)

     
    
    import org.dreambot.api.script.AbstractScript;
    import org.dreambot.api.script.Category;
    import org.dreambot.api.script.ScriptManifest;
    import org.dreambot.api.script.listener.InventoryListener;
    import org.dreambot.api.wrappers.items.Item;
    
    @ScriptManifest(name = "TestItemChangeBug", author = "TestItemChangeBug", version = 1D, description = "TestItemChangeBug!", category = Category.AGILITY)
    public class MyScript extends AbstractScript implements InventoryListener {
    
        @Override
        public int onLoop() {
            return 10000;
        }
    
        @Override
        public void onItemChange(Item[] arg0) {
            log("" + arg0.length);
            for (Item item : arg0) {
    
                log(item.getName() + " : " + item.getAmount());
    
            }
        }
    
    }

    Example pics:

    When Unnoting on Phial its working great if you still have noted in Inv:

    Wyu1rFJ.png

     

     

    But if you dont have any Notes left it will only show a increased value:

    mU8vVA8.png

     

    And after a run of pray bones on alter with an empty inventory no change will be registered (Only if you sleep until you dont have bones left)...

    Also had made a screenshot for this but it only shows a empty console.

     

    Any one experienced the same issue(maybe from another script like grinding chocolate and sleepuntil no chocs are left)? Any Idea for a workaround?

     

     

     

    Link to comment
    Share on other sites

    That does seem to be a bug with the inventory listener itself, I'll add that to my backlog to take a look into.

    What do you mean by a run of pray bones on altar with an empty inv no change will be registered? I'm kind of confused as to what the error is on that end, the unnoting I understand when losing the noted item, I'll have to try to look and see a better way to portray that information. I have a feeling it has to do with the fact that the noted bones are replaced with the unnoted bone, and so it doesn't actually see the change.

    As far as what you're looking for on your sleepuntil, you should just be checking for animation.

    Link to comment
    Share on other sites

    18 hours ago, Nuclear Nezz said:

    That does seem to be a bug with the inventory listener itself, I'll add that to my backlog to take a look into.

    What do you mean by a run of pray bones on altar with an empty inv no change will be registered? I'm kind of confused as to what the error is on that end, the unnoting I understand when losing the noted item, I'll have to try to look and see a better way to portray that information. I have a feeling it has to do with the fact that the noted bones are replaced with the unnoted bone, and so it doesn't actually see the change.

    As far as what you're looking for on your sleepuntil, you should just be checking for animation.

    Ok, i made a little video to demonstrate what i mean. Just forget the thing about no change will be registered on empty inv.

    This will demonstrate the "bug".

    https://streamable.com/3iscn

    I manually cancelled my Sleep in the vid to demonstrate its working if you still have a item of the same kind in your Inventory. After this i just let it do his thing.

     

    Logging Method:

    	@Override
    	public void onItemChange(Item[] arg0) {
    		// TODO Auto-generated method stub
    		log("Item[]"+ arg0.length);
    		for (Item item : arg0) {
    			log(item.getName() + " : " + item.getAmount());
    		}
    		log("-----------------------");
    	}

    Link to comment
    Share on other sites

    Ahh I see the problem with that one at least, it's because the inventory monitor is just checked at the start of each onLoop, instead of being on a separate thread.

    I'll move it to another thread when I take a look at the note issue as well.

    Link to comment
    Share on other sites

    In the next release it will be moved to its own thread, and it will fire off a full list of any changes it sees, which it checks every 300ms
    So for example, if you move 5 bones from slot 20 to slot 21 it'll say

    bones in slot 20 -5
    bones in slot 21 +5

     

    Link to comment
    Share on other sites

    52 minutes ago, Pegleg said:

    Really thanks for being aware and thinking about/working on an solution.

    This Topic can be closed now i think.

     

     

    Let me know if that solves your issues. I tested it out pretty good, so it should be fine. I'll close this thread then, if you still have problems post it on the client release thread

    Link to comment
    Share on other sites

    Archived

    This topic is now archived and is closed to further replies.

    ×
    ×
    • Create New...

    Important Information

    We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.