Solved lore of item contains doesn't work

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

    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!

wrymain

Member
Feb 20, 2025
37
0
6
this don't work
Python:
on break of potatoes:
    lore of player's held item contains "Auto-Replant":
        remove 1 potato from inventory of player
        set event-block to potatoes[age=1]

but this work
Python:
if line 1 of lore of player's tool is "Auto-Replant":
    remove 1 potato from inventory of player
    set event-block to potatoes[age=1]

do i need addon?
 
this don't work
Python:
on break of potatoes:
    lore of player's held item contains "Auto-Replant":
        remove 1 potato from inventory of player
        set event-block to potatoes[age=1]

but this work
Python:
if line 1 of lore of player's tool is "Auto-Replant":
    remove 1 potato from inventory of player
    set event-block to potatoes[age=1]

do i need addon?

The first code seems to parse, can you tell me the error message that you get when you test it?
When I get home i'll test this but for now I can still try to help.
 
The first code seems to parse, can you tell me the error message that you get when you test it?
When I get home i'll test this but for now I can still try to help.
there's no error message actually. it just that the event doesn't work
 
My guess is that the event is what's wrong. Crops have really weird names and potatoes might not be the right syntax. I'd try things like `potato plant`

If that's not the issue, try expanding the condition like this to see if it's just that syntax not working as intended:


code_language.skript:
on break of potatoes:
    set {_tool} to player's tool
    set {_lore} to lore of {_tool}
    send {_lore} to player
    if {_lore} contains "Auto-Replant":
        send "&6It works!" to player


This example lets you see what the lore of the item actually looks like and adjust your code to work with it.
 
My guess is that the event is what's wrong. Crops have really weird names and potatoes might not be the right syntax. I'd try things like `potato plant`

If that's not the issue, try expanding the condition like this to see if it's just that syntax not working as intended:


code_language.skript:
on break of potatoes:
    set {_tool} to player's tool
    set {_lore} to lore of {_tool}
    send {_lore} to player
    if {_lore} contains "Auto-Replant":
        send "&6It works!" to player


This example lets you see what the lore of the item actually looks like and adjust your code to work with it.
`potato plant` don't work. and the code, it's an error on line
Python:
set {_lore} to lore of {_tool}
 
I did some reasurch and I beleave it should be on break of ripe potato plant:
also don't work too, potatoes works just fine actually, but when i add the lore condition, it broke, no errors

this is working, but not every time the lore "auto-replant" is going to be the first line. so i want to make it work no matter whichever the line would the auto replant be in

Python:
on break of potatoes:
    if line 1 of lore of player's tool is "Auto-Replant":
        remove 1 potato from inventory of player
        set event-block to potatoes[age=1]
 
Last edited:
set {_loreLine1} to 1st line of lore of player's tool
this is what I have on my server. it might work but it is slightly out dated
 
ok so idk who replied to me and gave me this code but it works perfectly just the way i wanted


Python:
on break of potatoes:
    loop lore of player's held item:
        if loop-value contains "&eAuto-Replant":
            remove 1 potato from inventory of player
            set event-block to potatoes[age=1]
 
That was mine (I deleted the message cuz I realized your original code works), but your original code works just fine though.

Also I didn't consider in that code that it takes 0.5 seconds (10 ticks) to actually pick up an item, so if you don't originally have a potato it would replace the potato for free. Also the original event doesn't check if the potato is fully grown, (age 4-7) so you could break a age 1 potato without a potato in your inventory to infinitely farm potatoes.


Python:
on break of potato:
    loop lore of player's held item:
        if loop-value contains "Auto-Replant":
            loop all items in player's inventory:
                loop 2 times:
                    if loop-item is potato:
                        remove 1 potato from inventory of player
                        set event-block to potatoes[age=1]
                    else:
                        send "&cYou don't have a potato to replant this!" to player
                    wait 10 ticks

This should fix the issues I mentioned.
 
Last edited:
  • Like
Reactions: wrymain