Solved How i display the lore of a item in a tooltip?

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

Ulises

New Member
Sep 21, 2022
6
0
1
28
  1. Script Version): 2.6.3
  2. Script Author: Ulises
  3. Minecraft Version: 1.17.1

    I tried to make it but i dont how, ig i can use a lot of if's but i want to avoid that

    i thought i could use the size of the list but idk


    on chat:
    if message contains "[item]":
    cancel event
    player is not holding air
    set {_message} to message
    set {_count} to amount of player's held item in player's inventory
    set {_lore::*} to lore of player's tool
    set {_a} to size of {_lore::*}
    replace all "[item]" with "&c[<tooltip:%{_lore::1}%%nl%%{_lore::2}%%nl%%{_lore::3}%%nl%%{_lore::4}%>&7x%{_count}% %name of player's tool%&c]<reset>" in {_message}
    send formatted "%player's displayname%&f: &7%{_message}%" to all players
 
  1. Script Version): 2.6.3
  2. Script Author: Ulises
  3. Minecraft Version: 1.17.1

    I tried to make it but i dont how, ig i can use a lot of if's but i want to avoid that

    i thought i could use the size of the list but idk


    on chat:
    if message contains "[item]":
    cancel event
    player is not holding air
    set {_message} to message
    set {_count} to amount of player's held item in player's inventory
    set {_lore::*} to lore of player's tool
    set {_a} to size of {_lore::*}
    replace all "[item]" with "&c[<tooltip:%{_lore::1}%%nl%%{_lore::2}%%nl%%{_lore::3}%%nl%%{_lore::4}%>&7x%{_count}% %name of player's tool%&c]<reset>" in {_message}
    send formatted "%player's displayname%&f: &7%{_message}%" to all players
Code:
on chat:
    if message contains "[item]":
        cancel event
        player is not holding air
        set {_message} to message
        set {_count} to amount of player's held item in player's inventory
        set {_lore} to join (lore of player's tool) with delimiter newline
        replace all "[item]" with "&c[<tooltip:%{_lore}%>&7x%{_count}% %name of player's tool%&c]<reset>" in {_message}
        send formatted "%player's displayname%&f: &7%{_message}%" to all players
 
Thanks a lot!!!
btw u could explain this "join (lore of player's tool) with delimiter newline" i never seen it before and i dont understand it
 
Ooooh that's so cool, it only works with texts? or i can use it with list variables
 
Status
Not open for further replies.