Solved Help with countdown

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

dudle

Active Member
Jan 31, 2017
135
0
16
45
Hello,

I'm willing to know how to make a countdown like "01:30", which automatically updates, decreasing the seconds by 1, and etc..

Could someone help me with this please?

I tried to do something like "set {second} to 30" and then " loop 30 times " which sets {second} to "{second} - 1", waits 1 tick, and then performs this action again but when it's like 9 seconds, it says something like this "00:9" and I want "00:09", same with minutes. How to do that?

Thanks
 
Let me know if this helped at all.

Code:
command /timer <integer>:
    trigger:
        set {_countdown} to arg 1
        wait 1 tick
        broadcast "%{_countdown}%"
        loop arg 1 times:
            remove 1 from {_countdown}
            wait 1 second
            broadcast "%{_countdown}%"

You can add more to the broadcast or how ever you are handling it, example:

Code:
broadcast "%{_countdown}% seconds."
 
Let me know if this helped at all.

Code:
command /timer <integer>:
    trigger:
        set {_countdown} to arg 1
        wait 1 tick
        broadcast "%{_countdown}%"
        loop arg 1 times:
            remove 1 from {_countdown}
            wait 1 second
            broadcast "%{_countdown}%"

You can add more to the broadcast or how ever you are handling it, example:

Code:
broadcast "%{_countdown}% seconds."
Not really, it just broadcasts 10, 9, 8, 7, 6, 5 etc.. But I want it to be like 10, 09, 08, 07, 06...
 
It's easy thought

Code:
command /timer <integer>:
    trigger:
        set {_countdown} to arg 1
        wait 1 tick
        broadcast "%{_countdown}%"
        loop arg 1 times:
            remove 1 from {_countdown}
            wait 1 second
            {_countdown} is less than {_10}:
                broadcast "0%{_countdown}%"
            else:
                broadcast "%{_countdown}%"

You can add more to the broadcast or how ever you are handling it, example:

Code:
broadcast "%{_countdown}% seconds."
[/QUOTE]
 
It's easy thought

Code:
command /timer <integer>:
    trigger:
        set {_countdown} to arg 1
        wait 1 tick
        broadcast "%{_countdown}%"
        loop arg 1 times:
            remove 1 from {_countdown}
            wait 1 second
            {_countdown} is less than {_10}:
                broadcast "0%{_countdown}%"
            else:
                broadcast "%{_countdown}%"

You can add more to the broadcast or how ever you are handling it, example:

Code:
broadcast "%{_countdown}% seconds."
[/QUOTE]
Works, thanks!
 
Status
Not open for further replies.