Jump to content

Checking numbers of items in a stack


Recommended Posts

Posted

hey there forums,

 

I was just wondering if it would be possible to check the amount of grounditems in a stack. like arrows on the ground. then pick them up if the stack is greater than a number. i tried :

 

GroundItem loot = getGroundItems().closest(g.item);
log("test1");
if(loot.getAmount() > 3 && (!inventory.isFull() || inventory.contains(g.item)))
{
log("test2 in if statement");
loot.interact("Take");
sleep(random(800,1000));
 
}
 --------
and the "loot.getamount() > 3" always made my code crash.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...