Detect item name but ignoring lore

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

BrownMee

Active Member
Apr 16, 2018
126
6
18
23
I'm using this code
Code:
if items in player's inventory is 1 of leather with name "&7Pig Eyes x 1":

if items in player's inventory is 16 of leather with name "&7Pig Eyes x 16":

if items in player's inventory is 32 of leather with name "&7Pig Eyes x 32":

It only works if i change "is" to "contains"
but if I put contains it will break other code too
 
I'm using this code
Code:
if items in player's inventory is 1 of leather with name "&7Pig Eyes x 1":

if items in player's inventory is 16 of leather with name "&7Pig Eyes x 16":

if items in player's inventory is 32 of leather with name "&7Pig Eyes x 32":

It only works if i change "is" to "contains"
but if I put contains it will break other code too
player's inventory contains more than one item even if it's empty the inventory is filled with air
you have to use contains to check if the player has a an item in his inventory. So how's using contains breaking other codes ? are there any errors ?
 
player's inventory contains more than one item even if it's empty the inventory is filled with air
you have to use contains to check if the player has a an item in his inventory. So how's using contains breaking other codes ? are there any errors ?
It will trigger other code also because they have same name just different number
 
Code:
loop all items in inventory of player:
    if loop-item is 1  of leather with name "&7Pig Eyes x 1":
    if loop-item is 16 of leather with name "&7Pig Eyes x 16":
    if loop-item is 32 of leather with name "&7Pig Eyes x 32":

If it doesn't work:
Code:
loop all items in inventory of player:
    if amount of loop item is 1:
        if loop-item is leather with name "&7Pig Eyes x 1":
    if amount of loop-item is 16:
        if loop-item is leather with name "&7Pig Eyes x 16":
    if amount of loop-item is 32:
        if loop-item is leather with name "&7Pig Eyes x 32":
 
Code:
loop all items in inventory of player:
    if loop-item is 1  of leather with name "&7Pig Eyes x 1":
    if loop-item is 16 of leather with name "&7Pig Eyes x 16":
    if loop-item is 32 of leather with name "&7Pig Eyes x 32":

If it doesn't work:
Code:
loop all items in inventory of player:
    if amount of loop item is 1:
        if loop-item is leather with name "&7Pig Eyes x 1":
    if amount of loop-item is 16:
        if loop-item is leather with name "&7Pig Eyes x 16":
    if amount of loop-item is 32:
        if loop-item is leather with name "&7Pig Eyes x 32":
Doesnt work.
I have 16 only and i can click 32
[doublepost=1588162993,1588162595][/doublepost]
Code:
loop all items in inventory of player:
    if loop-item is 1  of leather with name "&7Pig Eyes x 1":
    if loop-item is 16 of leather with name "&7Pig Eyes x 16":
    if loop-item is 32 of leather with name "&7Pig Eyes x 32":

If it doesn't work:
Code:
loop all items in inventory of player:
    if amount of loop item is 1:
        if loop-item is leather with name "&7Pig Eyes x 1":
    if amount of loop-item is 16:
        if loop-item is leather with name "&7Pig Eyes x 16":
    if amount of loop-item is 32:
        if loop-item is leather with name "&7Pig Eyes x 32":
the second one also doesnt work. It has errors with cant compare item
 
So sorry, this should work:
Code:
loop all items in inventory of player:
    if item amount of loop item is 1:
        if loop-item is leather with name "&7Pig Eyes x 1":
    if item amount of loop-item is 16:
        if loop-item is leather with name "&7Pig Eyes x 16":
    if item amount of loop-item is 32:
        if loop-item is leather with name "&7Pig Eyes x 32":
 
So sorry, this should work:
Code:
loop all items in inventory of player:
    if item amount of loop item is 1:
        if loop-item is leather with name "&7Pig Eyes x 1":
    if item amount of loop-item is 16:
        if loop-item is leather with name "&7Pig Eyes x 16":
    if item amount of loop-item is 32:
        if loop-item is leather with name "&7Pig Eyes x 32":
got an error with cant compare
 
Just realized that I forgot "-" in line 2. Try this:
Code:
loop all items in inventory of player:
    if item amount of loop-item is 1:
        if loop-item is leather with name "&7Pig Eyes x 1":
    if item amount of loop-item is 16:
        if loop-item is leather with name "&7Pig Eyes x 16":
    if item amount of loop-item is 32:
        if loop-item is leather with name "&7Pig Eyes x 32":
 
Just realized that I forgot "-" in line 2. Try this:
Code:
loop all items in inventory of player:
    if item amount of loop-item is 1:
        if loop-item is leather with name "&7Pig Eyes x 1":
    if item amount of loop-item is 16:
        if loop-item is leather with name "&7Pig Eyes x 16":
    if item amount of loop-item is 32:
        if loop-item is leather with name "&7Pig Eyes x 32":
loop-item or loop item is the same thing the mistake is, with name isn't a thing in skript
this should work
Code:
if loop-item is leather named "&7Pig Eyes x 16":
    #code
if it still can't compare then check the item type and its name separately
Code:
if loop-item is leather:
    if name of  loop-item is "&7Pig Eyes x 16":
        #code
 
  • Like
Reactions: rustedst
Status
Not open for further replies.