Reading lore of player's item

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


    You can always check out skUnity Downloads for downloads and any other information about Skript!

Not open for further replies.


Jul 28, 2017
Skript Version:2.2-dev29
Skript Author:
Minecraft Version: 1.12.1
Full Code:

on right click on player:
    if name of clicked player is "&a&lTrader":#12
        set {_lore::*} to lore of player's tool split by "||"
        loop {_lore::*}:
            set {parsed::*} to loop-text parsed as "Sell Price: %number%"
            set {_price::*} to uncolored loop-text parsed as "Sell Price: %text%"
            set {_price} to {parsed::1}
            play "BLOCK_NOTE_XYLOPHONE" to player at volume 1
            broadcast "&6Item is worth: &e%{_price}% Gold"
            exit loop

So I'm trying to make a Skript that can tell how much a player's item is worth by rightclicking an NPC. I'm just getting 2 errors, %number% and %text% is not valid item data. I haven't used parsing before, and I'm not sure how Subtext works, the wiki doesn't tell me much.

The forums seem empty on this subject, and the ones who have something regarding this, have code that doesn't work either.

I wonder if this is possible?

Thank you,
The only thing you're doing wrong is using loop-text instead of loop-value, loop-text would only work with text literals.
Thank you for the quick reply. Well I have no errors now, it just writes "item is worth <none> Gold".

Replaced loop-text with loop-value.
Could you show me how the lore of the item looks like? Also, what does {_price::1} outputs?
Ok so I had to restart my server for it to read lore properly, might be a citizens bug? {_price::*} and {_price::1} now outputs the correct amount.

You saved my day @Snow-Pyon, thank you so much <3
[doublepost=1503251818,1503250080][/doublepost]Sorry to disturb you again @Snow-Pyon, but I have a similar error now, trying to sell all items containing the right lore. I get the item data error again.
Can you spot why? Oh and btw, It removes 1 of each of the looped items, but what if you have a stack of 2? I've tried messing around with it, but the money dont add up, it just removes more items.

command /sellall:
        loop all items in player's inventory:
            set {_lore::*} to lore of loop-item split by "||"
            loop {_lore::*}:
                set {_test::*} to uncolored loop-value parsed as "Sell Price: %number% %text%"
                play "BLOCK_NOTE_XYLOPHONE" to player at volume 1
                remove 1 of loop-item from player's inventory
                add {_test::1} to player's balance
                send "&6You sold your item for: &e%{_test::1}% Gold" to player
                send "&6You now have: &e%player's balance% Gold" to player
                exit loop

Thank you very much.
[doublepost=1503309377][/doublepost]bump. Anyone got an idea how to do this?
Not open for further replies.