Solved Detect the amount of items set in a 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 community!

    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.

Oviewer

Member
Aug 8, 2017
4
0
0
Hey.
I need some help about items detection.
I need my program to detect how many blocks have been set in a chest by a player, in order to give him points (depending of the type of block, but that's not the problem).

But actually, it only counts one block, event if I put stacks and stacks, with this part of code :
code_language.skript:
on store:
    if event-item is coal block:
        add 1 to {coal.%player%}

And if I put this :
code_language.skript:
on store:
    set {test} to amount of blocks
    if event-item is coal block:
        add {test} to {coal.%player%}
It adds all the blocks of MC...

So I'm stuck and I don't know how to fix this, could you help me ? please :emoji_slight_smile:
 
Output ? or was it something I was supposed to write ? x)
'case {test} is here to change depending of hom many blocs you set in the chest.
 
Add that into the code and screen the message:
code_language.skript:
broadcast "%{test}%"
 
That's what happen when I put a single block of coal :

2017-08-09_14.32.58.png
 
Try:
code_language.skript:
set {test} to amount of event-item
 
Tried this :
code_language.skript:
on store:
    set {test} to amount of event-item
    if event-item is coal block:
        add {test} to {coal.%player%}

Got this :
[17:40:48] [Server thread/ERROR]: 'event-item stack' can only ever have one value at most, thus the 'amount of ...' expression is useless. Use '... exists' instead to find out whether the expression has a value. (abctotem.sk, line 214: set {test} to amount of event-item')
[doublepost=1502359477,1502293334][/doublepost]well, after long researches and with the help of some french guys, and a newer version of Skript 2.2, I solved my issue.
Thanks anyway, it could help me for the future :emoji_slight_smile:
 
Status
Not open for further replies.