Variables don't check other variables???

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

KingDooms

Member
Jun 10, 2020
26
0
1
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:
command /cooldown [<text>] [<text>]:
    permission: op
    trigger:
        if arg-1 is set:
            if arg-1 is "add":
                add arg-2 to {AllCooldowns::*}
            if arg-1 is "remove":
                remove arg-2 from {AllCooldowns::*}
            if arg-1 is "list":
                loop {AllCooldowns::*}:
                    send "%{AllCooldowns::%loop-index%}%" to player
        else:
            loop {AllCooldowns::*}:
                if {%loop-value%::%player%} is higher than 0:
                    set {CooldownCheck_%loop-value%::%player%} to "%{%loop-value%::%player%}%"
                    send "%{%loop-value%::%player%}%" to player
                    send "%{CooldownCheck_%loop-value%::%player%}%" to player
            wait 5 ticks
            loop {AllCooldowns::*}:
                if {%loop-value%::%player%} is not less than "%{CooldownCheck_%loop-value%::%player%}%": # This is the broken part :/
                    send "%loop-value%: %{%loop-value%::%player%}%" to player # The sends are for me to monitor
                    set {%loop-value%::%player%} to 0 
                    send "check: %{CooldownCheck_%loop-value%::%player%}%" to player
                    clear {CooldownCheck_%loop-value%::%player%}
                else:
                    send "Check: %{CooldownCheck_%loop-value%::%player%}%" to player
                    send "Loop Value: %{%loop-value%::%player%}%" to player
                    clear {CooldownCheck_%loop-value%::%player%}
 
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.
 
Status
Not open for further replies.