Cannot loop player's inventory

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

lucasmooon

Member
Feb 4, 2017
16
0
0
23
Hello : )

I'm trying to get all the player's items and their quantity. Once before you could loop the player's inventory and get the items and the amount, but now what the message returns is "inventory slot {number} of {player}".

Version: dev37c
Spigot 1.12.2

Code

code_language.skript:
command loop:
    trigger:
        loop all items in player's inventory:
            send "%loop-item%" to player

0uHJ2RH.png



EDIT: This image shows a 1.8 Skript with running this code

fZA86u7.png
 
Last edited:
I got lost on this, like Jaylawl said it should work.
Anyways I tried loop items name and it didnt work, so i tried type and it worked
code_language.skript:
command loop:
    trigger:
        loop all items in the inventory of player:
            send "item: %loop-item's type%" to player
 
What will always work (but is not recommended) is setting the item to a local variable first:
code_language.skript:
loop player's inventory:
    set {_item} to loop-item
    broadcast "%{_item}%"
 
Status
Not open for further replies.