Solved Checking Name and Lore of item before using it

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

ItsAlfiee

New Member
Jul 18, 2018
7
0
0
55
Essentially, I'd like to make a Skript where if you have a certain item with a certain name and you right click it, it will give you certain potion effects. I got this working but I wanted to add a lore to the items showing what effects you get, and it stopped the code working. Please help me fix this code.

My code:
code_language.skript:
on rightclick:
    if player is holding slimeball named "&b&lJaw Breaker":
            apply swiftness 3 to the player for 10 seconds
            apply jump boost 4 to the player for 10 seconds
            remove 1 slimeball named "&b&lJaw Breaker" from player's inventory
            message "&a&l(*) &aYou consumed a Jaw Breaker!"
 
I don't know, because as you say it is used to work, but anyway:

What version of Skript are you using (Don't say latest)?
 
  • Like
Reactions: ItsAlfiee
Hmm... This type of things should work in the version I use that is the last fork for Spigot, so I don't know how that things work in Bukkit 2.1.2

You probably should wait to another one with some more experience on this to check this out.
 
Hmm... This type of things should work in the version I use that is the last fork for Spigot, so I don't know how that things work in Bukkit 2.1.2

You probably should wait to another one with some more experience on this to check this out.

Should it just stop working because there is a lore on it? Does Skript classify it as a different item?
 
Should it just stop working because there is a lore on it? Does Skript classify it as a different item?
Nope, it should work also with lore, because you're only detecting the name of the item, if it's the correct name, the lore is invariably on the final result.
 
You should install the latest version from Bensku's fork: https://github.com/SkriptLang/Skript/releases (edit: you might want dev-36 as dev-37 still has issues)

Did that, and got this

upload_2018-7-19_13-18-44.png
 
Try
code_language.skript:
if tool of player is slimeball named "&b&lJaw Breaker":
 
  • Like
Reactions: ItsAlfiee
Hey @ItsAlfiee I tried this and it works
code_language.skript:
on rightclick:
    if player's tool is a slimeball:
        if name of player's tool contains "&b&lJaw Breaker":
            apply swiftness 3 to the player for 10 seconds
            apply jump boost 4 to the player for 10 seconds
            remove 1 of player's tool from player's inventory
            message "&a&l(*) &aYou consumed a Jaw Breaker!"

command /test:
    trigger:
        set {_jaw} to slimeball named "&b&lJaw Breaker"
        set 1st line of lore of {_jaw} to "&7Swiftness III"
        set 2nd line of lore of {_jaw} to "&7Jump Boost IV"
        give player 1 of {_jaw}
 
  • Like
Reactions: ItsAlfiee
@ItsAlfiee can you check your aliases-english.sk for a slimeball. Also try replacing slimeball with something like stone to see if that works. You can also try removing the lore and name part.
 
@ItsAlfiee can you check your aliases-english.sk for a slimeball. Also try replacing slimeball with something like stone to see if that works. You can also try removing the lore and name part.
the slimeball is the right item, i got it to work, but for some reason when you add lore to an item it wouldn't let me do "if name of players tool is" but if i do "if name of players tool contains" it works totally fine :emoji_slight_smile:
 
the slimeball is the right item, i got it to work, but for some reason when you add lore to an item it wouldn't let me do "if name of players tool is" but if i do "if name of players tool contains" it works totally fine :emoji_slight_smile:
I know the slimeball is the right item, but there could be something wrong with their aliases. And it seems that the "if name of tool of player is ..." should work, so you might want to report it on the issue tracker.
 
Youre right I probably should
[doublepost=1532032866,1532032307][/doublepost]I just reported it ... THEN naturally after i report it,
I test it again, and it works either way, IS or CONTAINS... what the heck, that is odd!
 
Youre right I probably should
[doublepost=1532032866,1532032307][/doublepost]I just reported it ... THEN naturally after i report it,
I test it again, and it works either way, IS or CONTAINS... what the heck, that is odd!
Strange... Well glad it works now
 
Sorry for a late reply, going to try all these methods tonight!
[doublepost=1532446271,1532445077][/doublepost]
Hey @ItsAlfiee I tried this and it works
code_language.skript:
on rightclick:
    if player's tool is a slimeball:
        if name of player's tool contains "&b&lJaw Breaker":
            apply swiftness 3 to the player for 10 seconds
            apply jump boost 4 to the player for 10 seconds
            remove 1 of player's tool from player's inventory
            message "&a&l(*) &aYou consumed a Jaw Breaker!"

command /test:
    trigger:
        set {_jaw} to slimeball named "&b&lJaw Breaker"
        set 1st line of lore of {_jaw} to "&7Swiftness III"
        set 2nd line of lore of {_jaw} to "&7Jump Boost IV"
        give player 1 of {_jaw}

This worked! Thanks a lot!
 
Status
Not open for further replies.