Advanced Splitting

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

Farid

Active Member
Feb 5, 2017
179
11
18
I would like to split the HP and get the number, I tried to split it at "||" but I have more lore under it
768011fc642d219fe96b8afab2615797.png


What my goal is >> To be able detect the HP number, and to be able to detech the hp regen.
My split >>
a07410e39aab03436c0f1f887a0b55eb.png


I have no clue what to do, and thanks for viewing my thread.
 
Try something like this:

code_language.skript:
set {_split::*} to uncoloured line 1 of player's tool's lore parsed as "HP: %number%"
send "%{_split::1}%" to the player

Run that code while holding the chestplate and it should send you the number (935 in this case, but it'll work no matter what number goes there). The 'parsed as' thing lets you tell it the layout of a text, and if the layout you defined matches, it will pull out the expressions you specified and store them in the given list. I'm using "uncoloured" because it's easier to make mistakes in the parsing if you don't ignore the color codes, since they're "invisible" in a sense.

Let me know if that doesn't work or if you have further questions about how 'parsed as' works.
 
I would like to split the HP and get the number, I tried to split it at "||" but I have more lore under it
768011fc642d219fe96b8afab2615797.png


What my goal is >> To be able detect the HP number, and to be able to detech the hp regen.
My split >>
a07410e39aab03436c0f1f887a0b55eb.png


I have no clue what to do, and thanks for viewing my thread.
Just get a specificaties line of THE lore And then replace &cHP REGEN with Nothing

Set {_temp} To line 2 of lore of player's tool
 
Damn, got sniped by you another time, but adding to what you've said, to get both, the hp & hp regen at the same time, you could do the following:
code_language.skript:
set {_lore::*} to lore of player's tool split by "||"
loop {_lore::*}:
    set {_value::*} to uncolored loop-value parsed as "HP[ REGEN]: %num%"
    if {_value::1} is set:
        add {_value::1} to {_hp::*}
 
Status
Not open for further replies.