#Need help with displaying cooldown that is counting up as a countdown
1 messages · Page 1 of 1 (latest)
Currently it is counting up in chat, but I need it to count down.
Example screenshot:
Also if it would show only the amount of seconds / minutes and not the decimals that would be nice
This is what using an ability looks like:
Here is an example of a condition in each ability: if difference between now and {cooldown::%player's uuid%} is not less than 5 seconds:
Here is the code that displays the time as of right now:
loop all players:
set {cooldownyeah::%loop-player's uuid%} to difference between {cooldown::%loop-player's uuid%} and now
send "%{cooldownyeah::%loop-player's uuid%}%" to loop-player ```
If i could get some help soon that would be nice thanks
(Please ping me)
if you want to count down, set the time to a date in the future, such as 4 minutes from now
if you want to get rid of the decimals, change the number accuracy setting in the skript config to 0
There’s also a bunch of timespan formatting snippets
alr so now it does count down but it starts counting up again
he's offline so could u help me @wicked raft
- be patient and dont ping please

sowwy
literally all i changed from the above code is i changed making the time now to set {cooldown::%player's uuid%} to 5 seconds from now
and changed the condition to if {cooldown::%player's uuid%} is 0 seconds:
and i'm trying to write smth that checks for the time being 0 and then stops counting but idk how to make it stop
i could prob just make a loop that changes it but idk
just check now > {}
wdym
what i'm doing rn is i'm making it check for the time being 0 seconds every tick then waiting 10 and if it's more than 0 it should stop counting but idk how to make it do that
loop all players:
if {cooldown::%loop-player's uuid%} is 0 seconds:
wait 10 ticks
if {cooldown::%loop-player's uuid%} is more than 0 seconds:
uhhh like stop counting????? ```
wrong variable hold on
there we go
are you doing this?
i did that yes
.
but it starts counting up after going to 0
because then you only ever need 1 variable--the timestamp at which the cooldown is ended
then you can use the difference between t1 and t2 to get the tim until then
yeah but how do i make it stop bc after it goes past 0 the abilities don't work
just delete the variable
how i didn't know u could do that lol
delete variable {cooldown::%loop-player's uuid%}
difference between 08:00 and 12:00 is 4 hours
difference between 16:00 and 12:00 is also 4 hours (technically -4 hours but skript takes the absolute value, you need to check if a time is > or < than now to get the sign)
like that?
delete {}
ah alr
I would delete it in the same place you set it, checking if the cooldown is expired,set COOLDOWN to DURATION from now wait DURATION + 1 tick #: (1 tick just in case) if now > COOLDOWN: #:check cooldown is in the past (expired) delete COOLDOWN
ok so i tried doing this but the thing is most of my abilities already have waiting in them so this won't work
what i'm trying to do is this every 1 tick: loop all players: if {cooldown::%loop-player's uuid%} is less than 1 second: wait 20 ticks if {cooldown::%loop-player's uuid%} is more than 0 seconds: delete {cooldown::%loop-player's uuid%}
it isn't working
it just counts up again
idk why it should delete it
i've messed with it a ton and it still won't do it
i made a command that deletes it and does work tho
dont loop all players every tick
why not
very inefficient
thats not a good attitude to have
and thats not an excuse to allow bad practices
well my max playercount is like 15 or so at once and my server is 32gb ddr5 ram
and some threadripper cpu lol
this works if you apply the cooldown in a function/custom effect
i'm stupid can u plz tell me how do do that o-o
make a function or custom effect that accepts
- an ID (cooldown name)
- a timespan (cooldown duration)
and apply the cooldown there
because those can be asynchronous without affecting main code
where do i find a tutorial to do this
idk how to define the id and timespana
timespan
found this but how do i change the parameters
literally change teh first line of the function
how
there is no documentation i can find
how do i format it
just keeps saying it doesn't understand

function cooldown(id, timespan):
broadcast "yes"
like idk how it's supposed to be formatted
there is no documentation
there is this
broadcast "yes"```
broadcast "yes" ```
the type of id should be string
you changed the wrong thing
ohhh nvm
i'm slow sry xd
k so now i just put the stuff from before into this
what do i change cooldown and duration to
just timespan and id?
or do i create variables or smth
ah
so like this?
set {_id} to {_timespan} from now
wait {_timespan} + 1 tick
if now > {_id}:
delete {_id} ```
no