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 our 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 Remove decimal place from cooldown time

Discussion in 'Skript' started by Nick, Mar 10, 2019.

  1. N

    Nick Member

    Joined:
    Jan 27, 2017
    Messages:
    8
    Likes Received:
    0
    How would i change my cooldown from "2 minutes and 30.44 seconds" to just "30 seconds"

    set {_waited} to difference between {globalbooster} and now
    if {_waited} is less than 60 minutes:
    set {_time} to difference between 60 minutes and {_waited}

    Thanks

    Also i know you could do this within the config but that would mess up anything else which i need decimal places for
     
  2. Yodaylay22

    Yodaylay22 Member

    Joined:
    Jul 24, 2018
    Messages:
    15
    Likes Received:
    1
    1 minute = 60 seconds // so 1 minute and 33 seconds = 93 seconds


    if {_waited} is less than 93 seconds:
     
  3. T

    TPGamesNL Well-Known Member

    Joined:
    Jan 20, 2018
    Messages:
    768
    Likes Received:
    49
    Medals:
    Try this:
    Code (Text):
    1. set {_str} to "%{_time}%"
    2. set {_l::*} to split {_str} at " "
    3. loop {_l::*}:
    4.     delete {_i}
    5.     set {_i} to loop-value parsed as a number
    6.     {_i} is set
    7.     set {_i} to round({_i})
    8.     replace every "%loop-value%" in {_str} with "%{_i}%"
    9. message "Cooldown time: %{_str}%"
     
  4. N

    Nick Member

    Joined:
    Jan 27, 2017
    Messages:
    8
    Likes Received:
    0
    Already got it working with something pretty much the same as this but forgot to reply, anyway thanks
     
  5. T

    TPGamesNL Well-Known Member

    Joined:
    Jan 20, 2018
    Messages:
    768
    Likes Received:
    49
    Medals:
    Lol no problem
     
Loading...