Jump to content
×
×
  • Create New...

Drop All Inventory Help


Noyan802
 Share

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

Never mind I solved it:

 

for (Item Tinore:ctx.inventory.select().id(TinOreID) ) {
    ctx.inventory.drop(Tinore, true);}
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

 Share