Solved Lore not recognized

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

inavir

Member
May 1, 2017
10
0
0
31
Skript Version: dev29
Skript Author: Bensku
Minecraft Version: 1.12

Hello, for some reason lore on my items isn't being recognized at all.

code_language.skript:
command /lorecheck:
    trigger:
        set {_firstline} to first element out of split lore of player's tool at "||"
        message "%{_firstline}%"
        Set {_lore} to lore of player's tool
        message "%{_lore}%"
        Set {_lore::*} to {_lore} split at "||"
        message "%{_lore::*}%"

There are no errors on reload.

All three should work, but I just get <none> 3 times. I'm using version dev29 (bensku's fork), on 1.12 paperspigot. Am I doing something wrong?
 
Last edited:
I'm not to sure what you want but if you want a command that just reads off lore, here is the one I use, hopefully it helps?
code_language.skript:
command /lore:
    trigger:
        set {_lore.check} to 1
        set {_lore.check.times} to 1
        while {_lore.check} is 1:
            if line {_lore.check.times} of lore of player's tool is not set:
                set {_lore.check} to 0
            else:
                message "%line {_lore.check.times} of lore of player's tool%"
            add 1 to {_lore.check.times}
 
EDIT:
If you have a similar issue, install skquery. Seems like with just default skript, all three forms will parse correctly, but will screw up somewhere. Skript seems to only be able to check at x line of lore. In order to use "lore of item" or check if it's set, skquery is needed.

------------------


I'm not to sure what you want but if you want a command that just reads off lore, here is the one I use, hopefully it helps?
code_language.skript:
command /lore:
    trigger:
        set {_lore.check} to 1
        set {_lore.check.times} to 1
        while {_lore.check} is 1:
            if line {_lore.check.times} of lore of player's tool is not set:
                set {_lore.check} to 0
            else:
                message "%line {_lore.check.times} of lore of player's tool%"
            add 1 to {_lore.check.times}
Thanks, this worked! (checking for lore on line x of an item). However, this solution is much longer and harder to work with than what I'd like to use, namely being
code_language.skript:
set {_lore::*} to lore of player's held item split at "||"
or this:
set {_lore} to lore of player's tool

Since they let me save the lore as a list variable, which I can loop through easily later. To be more exact, my exact code looks like so:

code_language.skript:
function getStatData(item: item, idenf: text, separator: text) :: number:
    #Set lore of item to a string array
    Set {_lore} to lore of {_item}
    Set {_lore::*} to {_lore} split at "||"

    #Used for parts of the function
    set {_level} to 0
    set {_line} to 0

    loop {_lore::*}:

        #Get the index that it's looking at
        set {_line} to {_line} + 1
     
        #Do stuff

This worked in prior versions, such as 1.8 and 1.9, but now when I've updated my local testing server, it setting a variable equal to the lore of a player's tool doesn't seem to work at all in 1.12.

To put things in perspective, here's an example that shows how your method works, but the old one not working.
code_language.skript:
command /testlore:
  trigger:
    if lore of player's held item is not set:
      message "There's nothing"
    else:
      message "There is lore"
    if line 1 of lore of player's held item is not set:
      message "There's seriously nothing why are you checking?"
    else:
      message "There's something on line 1!"

When using this command, it'll say at first "there's nothing", implying that the lore of the player's held item is not set, but also say "There's something on line 1!", strangely enough.

The most confusing part for me is that not only did the prior method work on earlier versions, but it's still being recommended in various threads with similar issues.
 
Last edited by a moderator:
Status
Not open for further replies.