Skip to main content

MakeCode: Trying to check correct items placed in a chest

Comments

6 comments

  • Debbie Alexander
    Moderator Beacon of Knowledge Super Star

    Hi,  Kevin Tan  This is interesting.
    It seems to me that this is the best place right now. ;)
    If you run the copychest command by itself, is it working as expected?

    0
  • Debbie Alexander
    Moderator Beacon of Knowledge Super Star

    Just as a comment, Kevin Tan did you notice in your nested if statements that you ask if "pickedItem" is both meat and apple? It can never be both. The little exclamation point on the second if statement is complaining to you. I'm not sure if that is the reason or not. More likely, it is because you set pickedItem to zero, which is an integer. Then you tried to compare it to a block. Maybe I am misunderstanding the command.

     

    I would think you would want to be using "get item id from slot (#)" or "get item count from slot (#)"

    0
  • Kevin Tan

    Hi Deborah. Yeah, I know pickedItem cannot be both apple and meat but I just don't know how else to tell MakeCode to check for both items.

    I did think about using "agent get item id from slot #". Let me think further how exactly to do this. Thanks

    0
  • Debbie Alexander
    Moderator Beacon of Knowledge Super Star

    Kevin Tan

    This is what my students and I came up with. I used a list, and my students went for a slightly more hard-coded idea.

    https://makecode.com/_Fa9R621tjJTf

    The numbers are the item ids of the four items we chose to use. You will have to choose your own items / item ids.

    https://makecode.com/_haJ10oVxre5Y

    0
  • Sean LAWSON

    This is very helpful😁😁😁😁😁😁😁😁😁😁😁😁😁😁

     

    0
  • Moderator Beacon of Knowledge Super Star

    @sean Lawson
    Nothin' better than bein' helpful!
    Glad to hear it.

    0

Please sign in to leave a comment.