1. 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!

  2. LOOKING FOR A VERSION OF SKRIPT?

    You can always check out our Wiki for downloads and any other information about Skript!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Solved parse error

Discussion in 'Skript' started by CziSKY, Jul 19, 2017.

Thread Status:
Not open for further replies.
  1. CziSKY

    CziSKY Member

    Joined:
    Feb 22, 2017
    Messages:
    25
    Likes Received:
    0
    Code (Skript):
    1. on damage:
    2.     set {_d::*} to lore of attacker's tool parsed as "%string%||Damage: +%number%||%String%"
    3.     set damage to damage + {_d::2} parsed as number
    [00:03:42] [Server thread/ERROR]: ': + %number%||%string%"' is not a valid item data (skylevel.sk, line 3: set {_d::*} to lore of attacker's tool parsed as "%string%||Damage: + %number%||%string%"')

    please!!! thanks

     
    • Useful Useful x 1
  2. Best Answer:
    Post #14 by ShaneBee, Jul 20, 2017
  3. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    227
    What do you expect it to do?
     
    • Friendly Friendly x 1
  4. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    227
    If I hurt a zombie and lore of my tool contains "damage + 15" then added 15 damage to damage
    translate by google (my english is bad QUQ
     
    • Useful Useful x 1
  5. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    227
    `damage + 15` is just an example, you want any number to work right?
    Also, is this coloured, and is this in a separate line? Which one counting from the top? Or is it the only text in the lore?
     
    • Friendly Friendly x 1
  6. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    227
    yes i want any number to work
    ....i forget uncoloured and it's not a separate line I want it to work any line
    like plugin "Itemlorestats"
    --- Double Post Merged, Jul 19, 2017, Original Post Date: Jul 19, 2017 ---
    Please...! it's important for me QAQ
     
    • Useful Useful x 1
  7. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    227
    Try this:
    Code (Skript):
    1. on damage:
    2.     set {_d::*} to lore of attacker's tool parsed as "%string%||Damage: +%number%||%string%" split at "||"
    3.     set damage to damage + {_d::2} parsed as number
     
  8. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    227
     

    Attached Files:

  9. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    227
    IDK, then
     
    • Friendly Friendly x 1
  10. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    227
    oh .. but thank you
     
  11. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    227
    Perhaps something like this will work.

    Code (Skript):
    1. on damage of a zombie:
    2.     if 2nd line of lore of attacker's tool is set:
    3.         if 2nd line of lore of attacker's tool contains "Damage +":
    4.             set {_lore} to 2nd line of lore of attacker's tool
    5.             set {_subtext} to subtext of {_lore} from characters 10 to length of {_lore}
    6.             set {_extradmg} to "%{_subtext}%" parsed as number
    7.             increase damage by {_extradmg}
     
    • Friendly Friendly x 1
  12. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    227
    If i do not want to limit it on 2nd line ?..
     
  13. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    227
    I don't really know, except for simply repeating the code above for each line.

    Code (Skript):
    1. on damage of a zombie:
    2.     if 1st line of lore of attacker's tool is set:
    3.         if 1st line of lore of attacker's tool contains "Damage +":
    4.             set {_lore} to 1st line of lore of attacker's tool
    5.             set {_subtext} to subtext of {_lore} from characters 10 to length of {_lore}
    6.             set {_extradmg} to "%{_subtext}%" parsed as number
    7.             increase damage by {_extradmg}
    8.     else if 2nd line of lore of attacker's tool is set:
    9.         if 2nd line of lore of attacker's tool contains "Damage +":
    10.             set {_lore} to 2nd line of lore of attacker's tool
    11.             set {_subtext} to subtext of {_lore} from characters 10 to length of {_lore}
    12.             set {_extradmg} to "%{_subtext}%" parsed as number
    13.             increase damage by {_extradmg}
    14.     else if 3rdd line of lore of attacker's tool is set:
    15.         if 3rd line of lore of attacker's tool contains "Damage +":
    16.             set {_lore} to 3rd line of lore of attacker's tool
    17.             set {_subtext} to subtext of {_lore} from characters 10 to length of {_lore}
    18.             set {_extradmg} to "%{_subtext}%" parsed as number
    19.             increase damage by {_extradmg}
    20.     else if 4th line of lore of attacker's tool is set:
    21.         if 4th line of lore of attacker's tool contains "Damage +":
    22.             set {_lore} to 4th line of lore of attacker's tool
    23.             set {_subtext} to subtext of {_lore} from characters 10 to length of {_lore}
    24.             set {_extradmg} to "%{_subtext}%" parsed as number
    25.             increase damage by {_extradmg}
    26. #Repeat for each line or lore.
    27. #And on and on and on.......
     
    • Friendly Friendly x 1
  14. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    227
    oh :-( i I do not want to do that but thank you
     
  15. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    227
    Code (Skript):
    1. set {_lore::*} to lore of attacker's tool split by "||"
    2.  
    3. loop {_lore::*}:
    4.    
    5.     set {_extraDamage} to first element of (uncolored loop-value parsed as "Damage: +%number%")
    6.  
    7. if {_extraDamage} is set:
    8.     set damage to damage + {_extraDamage}
     
    • Friendly Friendly x 1
    • Useful Useful x 1
  16. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    227
    Thank you
    awesome answer!!!!!:-D
     
Thread Status:
Not open for further replies.

Share This Page

Loading...