Solved Store the first row of "Lore"

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

Status
Not open for further replies.

KrswtkhrSK

Member
Jan 28, 2017
27
2
1
I want to store the first line of the item lore in the variable.

code_language.skript:
on rightclick holding diamond sword:
  set {_lore} to line 1 of event-item's lore


I tried writing code referring to Doc, but it does not work out very well:emoji_sweat:
thanks.
 
I'm currently using Bensku's fork of Skript, and your above code seems to work for me; however, if you're not using it, or it's not working for some other reason, the docs do say that setting a variable to a specific line of the lore does not work.

If the issue persist, doing something like this may help:
code_language.skript:
on rightclick holding diamond sword:
  set {_lore::*} to event-item's lore split at "||"
  broadcast "%{_lore::1}%"

Splitting at "||", because in the raw lore text, it is used to separate lines.
 
I'm currently using Bensku's fork of Skript, and your above code seems to work for me; however, if you're not using it, or it's not working for some other reason, the docs do say that setting a variable to a specific line of the lore does not work.

If the issue persist, doing something like this may help:
code_language.skript:
on rightclick holding diamond sword:
  set {_lore::*} to event-item's lore split at "||"
  broadcast "%{_lore::1}%"

Splitting at "||", because in the raw lore text, it is used to separate lines.
code_language.skript:
set {_firstline} to first element out of split lore of player's tool at "||"
 
@Pikachu You have no chill when it comes to replying with a more efficient and compact version of the same code xD
 
Status
Not open for further replies.