Jump to content

Checking numbers of items in a stack


roguehippo

Recommended Posts

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.
Link to comment
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.
Note: Your post will require moderator approval before it will be visible.

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.

  • Recently Browsing   0 members

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