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.

Solved How to remove Decimal from time?

Discussion in 'Skript' started by minecubeks, Jan 21, 2022.

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

    minecubeks Member

    Joined:
    Oct 4, 2020
    Messages:
    4
    Likes Received:
    0
    Hi i maded daily reward system and i also maked checker that count how long player must wait until they can claim it again.

    Code (Text):
    1. set {timetowait} to difference between {dailyrewardcooldown::%player%} and now
    2. set {remaining.time} to difference between {timetowait} and 24 hours
    3. send "%{prefix}%&cYou cant claim daily reward! You must wait %{remaining.time}%!"
    From {remaining.time} im getting for example 17 hours and 42.85 minutes and i want to remove the decimal part or the number. (sorry for bad english)
     
  2. Tenfont

    Tenfont Member

    Joined:
    Mar 28, 2021
    Messages:
    24
    Likes Received:
    2
    Code (Text):
    1. function floorTimespan(time: timespan) :: timespan:
    2.     set {_s} to join (regex split "%{_time}%" at ".\d+")
    3.     return {_s} parsed as timespan
    Example:
    Code (Text):
    1. set {_a} to "2 minutes and 36.47 seconds" parsed as timespan
    2. broadcast floorTimespan({_a}
    3. # output: 2 minutes and 36 seconds
     
  3. minecubeks

    minecubeks Member

    Joined:
    Oct 4, 2020
    Messages:
    4
    Likes Received:
    0
    Error:

    Can't understand this expression: 'join (regex split "%{_time}%" at ".\d+")' (main.sk, line 162: set {_s} to join (regex split "%{_time}%" at ".\d+")')
     
  4. Tenfont

    Tenfont Member

    Joined:
    Mar 28, 2021
    Messages:
    24
    Likes Received:
    2
    RegEx split effect only works for Skript 2.5.2 and above
     
  5. minecubeks

    minecubeks Member

    Joined:
    Oct 4, 2020
    Messages:
    4
    Likes Received:
    0
    Oh, ok. But thanks anymore.
     
Thread Status:
Not open for further replies.

Share This Page

Loading...