> 1001 Not working?

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

ItsMCB

Member
May 20, 2018
46
1
8
24
www.vexel.media
Why is my code allowing the user's pickaxe level to go over 1000? I have looked this up and it seems like I'm doing the right thing.
code_language.skript:
on mine:
    if player's tool is a pickaxe:
        if {_exp} > 1001:
            message "&cTOOL POWERUP OVERLOADED! &fYou should use your powerup (RIGHT CLICK)."
            stop
        else:
            set {_lore} to lore of player's tool
            set {_split::*} to {_lore} split at " "
            set {_exp} to uncolored {_split::2} parsed as a number
            set {_exp} to {_exp} + 1
            set lore of player's tool to "&e&lEXP: &f%{_exp}% &7/1000"

The goal of this code is that if the player's pickaxe EXP is over 1000 it alerts the player that its overloading and should use it on other "powerups".
 
The {_exp} variable isn't set at that point. You have to do it in the following way for it to work:
code_language.skript:
on mine: # I would use on mine of any ore

  tool is a pickaxe
  set {_exp} to first element out of (uncolored tool's lore parsed as "EXP: %number%")
   
  if {_exp} is greater than 1000:
    send "Your message"
  else:
    set tool's lore to "<yellow><bold>EXP: %{_exp} + 1%"
 
The {_exp} variable isn't set at that point. You have to do it in the following way for it to work:
code_language.skript:
on mine: # I would use on mine of any ore

  tool is a pickaxe
  set {_exp} to first element out of (uncolored tool's lore parsed as "EXP: %number%")
 
  if {_exp} is greater than 1000:
    send "Your message"
  else:
    set tool's lore to "<yellow><bold>EXP: %{_exp} + 1%"
Thanks for the response, but for some reason the EXP is staying at 1 no matter how much I mine.
upload_2018-5-31_22-42-42.png

[doublepost=1527872798,1527824598][/doublepost]
Thanks for the response, but for some reason the EXP is staying at 1 no matter how much I mine.
upload_2018-5-31_22-42-42.png
Never mind I fixed it, thank you for helping me :emoji_slight_smile:
 
Status
Not open for further replies.