Jump to content

Check for certain amount of items on the ground


Recommended Posts

Posted (edited)

Hello im having problem a little trouble with my script.

 

I want it to be able to check the ground, if number of items on the ground currently are more than 28 or less than 28.

 

if its less then 28 then im going to continue dropping items

 

if its more than 28 then im going to pick them up

 

but it says bad operander type I searched around and found no answer.

 

I attached a screenshot of the problem below thanks alot smile.png

 

merry christmas everyone!

post-243631-0-49403200-1482540696_thumb.png

Edited by Alext1996
Posted (edited)

m8... isFull() is a method

!inventory.isFull()

also, your operand is backwards

 

=> is not greater than or equal to. that's an arrow.

 

>= is greater than or equal to.

 

edit: you're also trying to ask if a GroundItem (an object) is greater than or equal to 28 / less than 28.

That's like asking someone, "Is my textbook less than 20?". You can't compare an object to a number. Use getAmount().

 

it looks like you need to familiarize yourself with java a little bit more before coding.

 

Edited by Imateamcape
Posted

m8... isFull() is a method

!inventory.isFull()

also, your operand is backwards

 

=> is not greater than or equal to. that's an arrow.

 

>= is greater than or equal to.

 

edit: you're also trying to ask if a GroundItem (an object) is greater than or equal to 28 / less than 28.

That's like asking someone, "Is my textbook less than 20?". You can't compare an object to a number. Use getAmount().

 

it looks like you need to familiarize yourself with java a little bit more before coding.

 

yeah I know isfull is a method, that is just a typo I was asking about if there is a way to check how many objects are on the ground.

 

I have watched so many tutorials on youtube im sick of it thats why i decided to start coding instead so I learn by doing

 

thanks for the help

m8... isFull() is a method

!inventory.isFull()

also, your operand is backwards

 

=> is not greater than or equal to. that's an arrow.

 

>= is greater than or equal to.

 

edit: you're also trying to ask if a GroundItem (an object) is greater than or equal to 28 / less than 28.

That's like asking someone, "Is my textbook less than 20?". You can't compare an object to a number. Use getAmount().

 

it looks like you need to familiarize yourself with java a little bit more before coding.

 

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...