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

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Solved Loop all items in player's inventory

Discussion in 'Requests' started by Rektb, Sep 10, 2017.

  1. Rektb

    Rektb New Member

    Jul 7, 2017
    Likes Received:
    Hi, I am trying to do a skript that loops items in player's inventory and then it adds it to a yml file. The problem is that when I reload my skript, an error appears saying "Can't understand this type of loop: "loop all items in player's inventory", etc". First I did something like this and I made a test using different items (incluiding potions)
    Code (Skript):
    1.                     loop 36 times:
    2.                         set {_call} to slot {_count} of player's inventory
    3.                         if {_call} is not air:
    4.                             add "%{_call}%" to skutil yaml list "items" from file "{@file}"
    5.                         add 1 to {_count}
    but when I see the yaml file...
    Code (Skript):
    2. items:
    3. - diamond_sword of Mending 1
    4. - grass_block
    5. - enchanted_book
    6. - spawn_egg
    7. - '145'
    8. - bottle_o'_enchanting
    9. - water_bottle # This is the potion, it appears as a water bottle
    When I used a command to get these items, I got a water bottle but not a potion
    Skript Version: Skript 2.2 (dev31) [Latest]
    Skript Author: Dzikoysk
    Minecraft Version: 1.12.1 [Running with latest spigot build]ç

    After that I tried to do the same thing but with a loop. And I wrote this:
    Code (Skript):
    2. command /invtest:
    3.     trigger:
    4.         loop all items in player's inventory:
    5.             loop-item is not air
    6.             add "%loop-item%" to skutil yaml list "test" from file "/plugins/KITS/sostupid.yml"
    So, I need a way to make the loop or to fix the potion error.
  2. Best Answer:
    Post #2 by ShaneBee, Sep 10, 2017
  3. ShaneBee

    Supporter + Addon Developer

    Sep 7, 2017
    Likes Received:
    Solution: Don't use YAML.

    Skript variables can hold a million values, so I don't know why would you want to use YAML.

    When trying to parse an item as text, you'll get the type of the item and the quantity, but no NBT values. So, you just CAN'T use anything else than skript variables for this.
    Rektb likes this.

Share This Page