Get number of custom item in 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!

LMKgaming

Member
Mar 13, 2025
21
1
3
I don't know how to get the number of custom item in player inventory and save to variable, please help me.
 
Does it work with custom item make by item edit or executable item, because I make the custom item independent with skript and I don't know how to get the data of that item into skript as variable or something else.
If you used itemsadder for it, it will work.

If you didn't, then have a look on the NBT of your custom item and try a condition about it.
 
If you used itemsadder for it, it will work.

If you didn't, then have a look on the NBT of your custom item and try a condition about it.
Can you give me an example for conditions using NBT of a custom item, I have skBee installed, is that enough?
 
can you try doing "send full nbt of held item of player to players" via a command or something? Send me the result too.
Sorry but I can't do this now, you can just make a simple custom item and example ít to me (my custom item has name, lore and nbt customized)
 
Sorry but I can't do this now, you can just make a simple custom item and example ít to me (my custom item has name, lore and nbt customized)
I need it and i'm not able to open a server for it. Please do it whenever you want and inform me, i can help you :emoji_slight_smile:
 
I need it and i'm not able to open a server for it. Please do it whenever you want and inform me, i can help you :emoji_slight_smile:
I use SkBee to get full nbt of my item
code_language.skript:
{
    "minecraft:lore": [
        '{"extra":[{"bold":false,"color":"gold","italic":false,"obfuscated":false,"strikethrough":false,"text":"→ ","underlined":false},{"bold":false,"color":"#084CFB","italic":false,"obfuscated":false,"strikethrough":false,"text":"P","underlined":false},{"bold":false,"color":"#1256FB","italic":false,"obfuscated":false,"strikethrough":false,"text":"ᴀ","underlined":false},{"bold":false,"color":"#1D61FB","italic":false,"obfuscated":false,"strikethrough":false,"text":"ᴄ","underlined":false},{"bold":false,"color":"#276BFB","italic":false,"obfuscated":false,"strikethrough":false,"text":"ᴋ","underlined":false},{"bold":false,"color":"#3176FC","italic":false,"obfuscated":false,"strikethrough":false,"text":"ᴇ","underlined":false},{"bold":false,"color":"#3C80FC","italic":false,"obfuscated":false,"strikethrough":false,"text":"ᴅ ","underlined":false},{"bold":false,"color":"#5095FC","italic":false,"obfuscated":false,"strikethrough":false,"text":"I","underlined":false},{"bold":false,"color":"#5BA0FC","italic":false,"obfuscated":false,"strikethrough":false,"text":"ᴄ","underlined":false},{"bold":false,"color":"#65AAFC","italic":false,"obfuscated":false,"strikethrough":false,"text":"ᴇ ","underlined":false},{"bold":false,"color":"white","italic":false,"obfuscated":false,"strikethrough":false,"text":"5","underlined":false}],"text":""}'
    ],
    "minecraft:enchantments": {
        levels: {
            "minecraft:efficiency": 25
        }
    },
    "minecraft:damage": 728,
    "minecraft:unbreakable": {},
    "minecraft:custom_name": '{"extra":[{"bold":true,"color":"green","italic":false,"obfuscated":false,"strikethrough":false,"text":"Super Special Pickaxe","underlined":false}],"text":""}',
    "minecraft:custom_data": {
        packed_ice: 5b,
        Unbreakable: 1b,
        Enchantments: [
            {
                lvl: 25s,
                id: "efficiency"
            }
        ],
        Damage: 728
    }
}
how to use it for counting number of item in inventory?
 
I use SkBee to get full nbt of my item
code_language.skript:
{
    "minecraft:lore": [
        '{"extra":[{"bold":false,"color":"gold","italic":false,"obfuscated":false,"strikethrough":false,"text":"→ ","underlined":false},{"bold":false,"color":"#084CFB","italic":false,"obfuscated":false,"strikethrough":false,"text":"P","underlined":false},{"bold":false,"color":"#1256FB","italic":false,"obfuscated":false,"strikethrough":false,"text":"ᴀ","underlined":false},{"bold":false,"color":"#1D61FB","italic":false,"obfuscated":false,"strikethrough":false,"text":"ᴄ","underlined":false},{"bold":false,"color":"#276BFB","italic":false,"obfuscated":false,"strikethrough":false,"text":"ᴋ","underlined":false},{"bold":false,"color":"#3176FC","italic":false,"obfuscated":false,"strikethrough":false,"text":"ᴇ","underlined":false},{"bold":false,"color":"#3C80FC","italic":false,"obfuscated":false,"strikethrough":false,"text":"ᴅ ","underlined":false},{"bold":false,"color":"#5095FC","italic":false,"obfuscated":false,"strikethrough":false,"text":"I","underlined":false},{"bold":false,"color":"#5BA0FC","italic":false,"obfuscated":false,"strikethrough":false,"text":"ᴄ","underlined":false},{"bold":false,"color":"#65AAFC","italic":false,"obfuscated":false,"strikethrough":false,"text":"ᴇ ","underlined":false},{"bold":false,"color":"white","italic":false,"obfuscated":false,"strikethrough":false,"text":"5","underlined":false}],"text":""}'
    ],
    "minecraft:enchantments": {
        levels: {
            "minecraft:efficiency": 25
        }
    },
    "minecraft:damage": 728,
    "minecraft:unbreakable": {},
    "minecraft:custom_name": '{"extra":[{"bold":true,"color":"green","italic":false,"obfuscated":false,"strikethrough":false,"text":"Super Special Pickaxe","underlined":false}],"text":""}',
    "minecraft:custom_data": {
        packed_ice: 5b,
        Unbreakable: 1b,
        Enchantments: [
            {
                lvl: 25s,
                id: "efficiency"
            }
        ],
        Damage: 728
    }
}
how to use it for counting number of item in inventory?
I couldn't see any definition for custom items.

So, you can try checking it's lore.


Python:
set {_i} to 0

loop all items in inventory of player:
    if lore of loop-item contains "a lore line":
        add item amount of loop-item to {_i}
       
# {_i} = item count.
 
I couldn't see any definition for custom items.

So, you can try checking it's lore.


Python:
set {_i} to 0

loop all items in inventory of player:
    if lore of loop-item contains "a lore line":
        add item amount of loop-item to {_i}
      
# {_i} = item count.
So sorry about that, i have try to get full nbt by skbee but this get error (maybe made by skBee) so i can only get the tag nbt only.
Can you example with an item that have both lore and name custom (also nbt custom), because i have more than 1 item have same lore but they are different.
 
Python:
set {_i} to 0

loop all items in inventory of player:
    if lore of loop-item contains "a lore line":
        if name of loop-item is "a full name of an item":
            add item amount of loop-item to {_i}
      
# {_i} = item count.
 
Python:
set {_i} to 0

loop all items in inventory of player:
    if lore of loop-item contains "a lore line":
        if name of loop-item is "a full name of an item":
            add item amount of loop-item to {_i}
     
# {_i} = item count.
Thanks a lot, i will try that code and return here if i still have problems
 
  • Like
Reactions: The0Felon