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 Can't read if variable is set?

Discussion in 'Skript' started by SmallDev, Apr 10, 2020.

Tags:
Thread Status:
Not open for further replies.
  1. SmallDev

    SmallDev Member

    Joined:
    Apr 6, 2020
    Messages:
    39
    Likes Received:
    0
    I'm making a shop, and have a lot of things working now, but I want to check if a player has his or her boost set up, if not I want to set it to 1, but when I check if it is, I always get the output that it wasn't any help would be appreciated thx.
    Code (Text):
    1. on right click on entity:
    2.             if name of entity is "Ye Old Fisherman":
    3.                         if player's held item is not a cod:
    4.                                     send "&c&lThat's not a fish!!!!!!" to player
    5.                         else:                          
    6.                                     if {_Boost.%player%} is set:
    7.                                                 set {_Money::1} to 10
    8.                                                 if lore of held item contains "&7Caught":  
    9.                                                             if held item's lore contains "cm":
    10.                                                                         set {_Original} to held item's lore
    11.                                                                         delete line 2 of held item's lore
    12.                                                                         set line 1 of held item's lore to regex replace all "cm" with "" in held item's lore
    13.                                                                         set {_lore::1} to held item's lore
    14.                                                                         set {_lore::2} to uncolored {_lore::1}
    15.                                                                         set lore of held item to {_Original}
    16.                                                                         set {_lore::3} to {_lore::2} parsed as a number
    17.                                                                         remove 1 of held item from player
    18.                                                                         add {_lore::3} to player's balance
    19.                                                                         send "&6$%{_lore::2}% &fwas recieved!!!" to player
    20.                                                                         delete {_Money::*}
    21.                                                                         delete {_lore::*}
    22.                                                                         delete {_Original}
    23.                                                                         delete {_SellMultiplier}
    24.                                     else if {_Boost.%player%} is not set:
    25.                                                 set {_Boost.%player%} to 1
    26.                                                 send "&5Your All Set!!!!!" to player
     
  2. HiqqhFive

    Supporter

    Joined:
    Jan 28, 2017
    Messages:
    60
    Likes Received:
    6
    Try to add after "if {_Boost.%player%} is set:" this:

    Code (Text):
    1. if {_Boost.%player%} is 1:
    and for the else you can use your messages from the "else" query for "if {_Boost.%player%} is set:"
     
  3. TPGamesNL

    Supporter Addon Developer Dev Programme

    Joined:
    Jan 20, 2018
    Messages:
    1,501
    Likes Received:
    107
    Medals:
    Are you aware that every variable that starts with an underscore (_) is local, meaning it will be deleted after the trigger ends.
     
  4. HiqqhFive

    Supporter

    Joined:
    Jan 28, 2017
    Messages:
    60
    Likes Received:
    6
    Sorry, my mistake.
    I have forgotten to remove the underscore.
     
  5. SmallDev

    SmallDev Member

    Joined:
    Apr 6, 2020
    Messages:
    39
    Likes Received:
    0
    I was not, but I fixed this. Thanks for the help,
     
Thread Status:
Not open for further replies.

Share This Page

Loading...