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.

Variables don't check other variables???

Discussion in 'Skript' started by KingDooms, Oct 22, 2021.

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

    KingDooms Member

    Joined:
    Jun 10, 2020
    Messages:
    23
    Likes Received:
    0
    So basically, I was making a cooldown command, incase any cooldown that I make gets stuck, but for some reason, it doesn't work. Basically how it works is it checks for any variable (that I manually insert) that is more than 0, we will call this a check, after 5 ticks, which should be enough for the cooldown/variable to go down, it will check if the variable is not less/higher than the check. When I make it check for not less, it works for every variable even if the check doesn't exist. When I make it check for higher, it doesn't work on any of them, even if the math is right. Any help?

    Code (Text):
    1. command /cooldown [<text>] [<text>]:
    2.     permission: op
    3.     trigger:
    4.         if arg-1 is set:
    5.             if arg-1 is "add":
    6.                 add arg-2 to {AllCooldowns::*}
    7.             if arg-1 is "remove":
    8.                 remove arg-2 from {AllCooldowns::*}
    9.             if arg-1 is "list":
    10.                 loop {AllCooldowns::*}:
    11.                     send "%{AllCooldowns::%loop-index%}%" to player
    12.         else:
    13.             loop {AllCooldowns::*}:
    14.                 if {%loop-value%::%player%} is higher than 0:
    15.                     set {CooldownCheck_%loop-value%::%player%} to "%{%loop-value%::%player%}%"
    16.                     send "%{%loop-value%::%player%}%" to player
    17.                     send "%{CooldownCheck_%loop-value%::%player%}%" to player
    18.             wait 5 ticks
    19.             loop {AllCooldowns::*}:
    20.                 if {%loop-value%::%player%} is not less than "%{CooldownCheck_%loop-value%::%player%}%": # This is the broken part :/
    21.                     send "%loop-value%: %{%loop-value%::%player%}%" to player # The sends are for me to monitor
    22.                     set {%loop-value%::%player%} to 0
    23.                     send "check: %{CooldownCheck_%loop-value%::%player%}%" to player
    24.                     clear {CooldownCheck_%loop-value%::%player%}
    25.                 else:
    26.                     send "Check: %{CooldownCheck_%loop-value%::%player%}%" to player
    27.                     send "Loop Value: %{%loop-value%::%player%}%" to player
    28.                     clear {CooldownCheck_%loop-value%::%player%}
     
  2. BaeFell

    BaeFell I'm Poppy
    Admin Supporter

    Joined:
    Nov 27, 2016
    Messages:
    906
    Likes Received:
    228
    You're comparing an integer and a string. Remove the speech marks and percentage signs and it should work. You could also try using "is greater than" as well. Sometimes Skript's syntax can be a bit iffy.
     
Thread Status:
Not open for further replies.

Share This Page

Loading...