Solved How can I get the name of an item in skript?

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

Sabified

Member
Jun 5, 2022
46
2
8
Hello!
I want the name of player's tool
If I try to do
Code:
set {_item} to player's tool
set {_itemName} to name of {_item}
It returns <none> because the item isn't "named" eg. with an anvil
[doublepost=1671881937,1671628679][/doublepost]To anyone who might want this in the future:
Code:
function getItemName(i: item) :: string:
    if {_i}'s name is set:
        return {_i}'s name
    else:
        return "%{_i}%"

command /itemname:
    trigger:
        send getItemName(player's tool)
 
Status
Not open for further replies.