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 Rounding an integer

Discussion in 'Skript' started by Aralwen, Jun 4, 2017.

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

    Aralwen Active Member

    Joined:
    May 26, 2017
    Messages:
    164
    Likes Received:
    14
    Hello,
    I am trying to round up a number by doing the command /mid it displays the distance between a predefined position, for example it shows 19.61.I would like it to take the nearest integer, in this case would like it to show 20.

    Skript :

    Code (Skript):
    1. command /setmid:
    2.     trigger:
    3.         set {Mid} to player's location
    4.  
    5. command /mid:
    6.     trigger:
    7.         set {MidPos.%player%} to distance between player and {Mid}
    8.         send "%{MidPos.%player%}%"

    Thank's for help


    Skript Version: 2.2
    Skript Author: ?
    Minecraft Version: 1.8.8


    Errors on Reload : Nothing
    Console Errors : Nothing


    Troubleshooting:

    Have you tried searching the docs? Yes
    Have you tried searching the forums ? Yes
     
  2. Best Answer:
    Post #2 by ShaneBee, Jun 4, 2017
  3. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,179
    Likes Received:
    218
    Code (Skript):
    1. set {MidPos.%player%} to round({MidPos.%player%})
     
    • Like Like x 1
    • Winner Winner x 1
  4. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,179
    Likes Received:
    218
    Thanks :emoji_slight_smile:
     
    • Like Like x 1
    • Agree Agree x 1
Thread Status:
Not open for further replies.

Share This Page

Loading...