Jump to content
×
×
  • Create New...

Drop All Inventory Help


Recommended Posts

Hello, I am writing a script for a basic power miner and needed help with dropping all the ores when the inventory becomes full. I wrote a for loop that drops tin ore 28 times but this doesn't seem to work. Any idea what I'm doing wrong? Thanks in advance. My script is:

 

import org.powerbot.script.Condition;
import org.powerbot.script.PollingScript;
import org.powerbot.script.Script;
import org.powerbot.script.rt4.*;

import java.util.concurrent.Callable;

@Script.Manifest(name = "Miner",description = "Mines",properties = "client=4; author=Noyan802; topic = 8")
public class Chicken extends PollingScript<ClientContext> {
    final static int TinID[]={11360,11361};
    @Override
    public void start() {

    }

    @Override
    public void poll() {
        if (ctx.players.local().animation()==-1 && ctx.inventory.select().count()<28){
            GameObject Tin = ctx.objects.select().id(TinID).nearest().poll();
            Tin.interact("Mine");
            Condition.wait(new Callable<Boolean>() {
                @Override
                public Boolean call() throws Exception {
                    return ctx.players.local().animation() != -1;
                }
            });
        }
        else {
            for (int i = 0; i <28 ; i++) {
                Item Tin=ctx.inventory.select().id(438).poll();
                ctx.inventory.drop(Tin, true);
            }



                }


            }


    }
Edited by Noyan802
Link to post
Share on other sites

Good to see you solved it.

Just a note, you are using the old way of selecting items. You should try using the newer way.

 ctx.inventory.toStream().id(TinOreID).collect(Collectors.toList())

 

  • Thanks 1
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.