Parsed As a Number 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.

SmallDev

Member
Apr 6, 2020
39
0
6
Im making a shop and need to change lore into a usable value, and I thought I had it using parsed as a number, but instead of working it adds 0 to the player's balance. Here's the code,
Code:
        set {_length} to line 1 of held item's lore parsed as a number

        add {_length} to balance of player
Please help, thanks.
 
Okay, so are there quotes in the lore itself? There really shouldn't be. You can set lore without quotes.
EDIT: This works fine for me.
Code:
command /test:
   trigger:
       set lore of held item to "1"
       set {_lore} to line 1 of held item's lore parsed as a number
       broadcast "%{_lore} + 10%" #Returns 11
 
There are no quotes, I can give you the full code tho,
Code:
on right click:
  set {_SellMultiplier} to 1
  if lore of held item contains "&7Caught":
    set {_Money::1} to 10
    if lore of held item contains "&7Caught":  
      if held item's lore contains "cm":
        delete line 2 of held item's lore
        set line 1 of held item's lore to regex replace all "cm" with "" in held item's lore
        set {_length} to line 1 of held item's lore parsed as a number
        add {_length} to balance of player
        send "&6$%{_length}% &fwas recieved!!!"
        delete {_length}
        delete {_Money::*}
 
Well first of all broadcast whats line 1 of held item's lore to regex replace all "cm" with "" in held item's lore.
 
The original lore was a number then cm
[doublepost=1586366183,1586366152][/doublepost]I was removing the cm part to get 1 number
[doublepost=1586366825][/doublepost]Would decimals effect this?
 
Please try what I have suggested in my previous reply. I think it can be 0 for two reasons: Couldn't parse the number, or it's really not a number.
 
Maybe the Skript can't read the lore for some reason? Yours works fine, although I don't see any problem with my Skript.
 
Status
Not open for further replies.