Counting items in chest

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

Shroomz

Supporter +
Jun 22, 2017
44
0
6
25
I have this:
code_language.skript:
on leftclick holding a book:
    if event-block is chest:
        if the name of player's tool contains "&fBank Account of":
            if event-block has charcoal or ghast_tear:

and now the thing I want is to count charcoals and ghast tears in it by names. So if there is charcoal named "10 coins" I wanna count how many 10 coins there is and make variable out of it.
 
3a240ca880.png
 
Hm? it gets the size of the item stack which is what you wanted then you can turn it into a variable.
I want the size of the stack in the chest's inventory...

Okey let's look it like this... I have 40 coal in my chest. 20 of them is named "x" and 20 of them is named "y"... Now by leftclicking I want to skript to tell me how many coal named "x" is there... and that number put into variable
 
code_language.skript:
on leftclick holding a book:
    if event-block is chest:
        if the name of player's tool contains "&fBank Account of":
            if event-block has charcoal or ghast_tear:
                set {item} to charcoal named "10 Coins" 
                set {amount} to amount of {item} in event-block's inventory
                broadcast "%{amount}%"
this only worked for me if i predefined the item in a variable as shown
 
Status
Not open for further replies.