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!

  2. LOOKING FOR A VERSION OF SKRIPT?

    You can always check out our Wiki for downloads and any other information about Skript!

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

Solved How to check lore of item if it has multiple lines?

Discussion in 'Skript' started by CrimZ0N, Dec 24, 2019.

Thread Status:
Not open for further replies.
  1. CrimZ0N

    CrimZ0N Member

    Joined:
    Jan 28, 2017
    Messages:
    56
    Likes Received:
    3
    Heya, been a while, here's a tldr.

    If I set an item to have lore "example" and then lets say "if lore of item contains "example"", it works, however, if I set the lore to "example1" and "example2" and then I check the lore for the same thing, it doesn't work.

    An example of what I'm trying to do

    command /stick:
    trigger:
    give player 1 stick with lore "example1" and "example2"

    on left click:
    if tool of player is stick:
    if lore of item contains "example1":
    message "Stick"

    Please do note that the lore's will vary and I want to check for multiple lines, and I tried to include both lines of lore in the "if lore of item contains", it didn't work. Am I doing it wrong, or is it impossible?

    Currently using bensku's fork v2.4.1 and SkQuery v4.1.1

    Cheers
     
  2. Best Answer:
    Post #2 by Policiu, Dec 24, 2019
  3. Policiu

    Policiu Member

    Joined:
    Jan 28, 2017
    Messages:
    15
    Likes Received:
    0
    Lore is now returned as a list of strings (set {_lore::*} to lore of item), so you need to specify a line (line 2 of lore, {_lore::2}, etc ...) or just place the entire lore in a string.

    Example:
    Code (Skript):
    1. if uncolored line 1 of the lore of the item contains "example1":
    2.  
    3. if "%uncolored lore of item%" contains "example1":
    4.  
    5. set {_lore::*} to uncolored lore of item
    6. loop {_lore::*}:
    7.   if loop-value contains "example1":

    Also, please format code with the insert code button.
     
    • Friendly Friendly x 1
  4. CrimZ0N

    CrimZ0N Member

    Joined:
    Jan 28, 2017
    Messages:
    56
    Likes Received:
    3
    Thanks, that solved it. I kept doing "if lore of item", no wonder it wasn't working, smh.
     
Thread Status:
Not open for further replies.

Share This Page

Loading...