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.

How should I go about allowing numbers to go above 9.22e18?

Discussion in 'Skript' started by 11thDoctor314, Mar 29, 2020.

Thread Status:
Not open for further replies.
  1. 11thDoctor314

    11thDoctor314 Member

    Joined:
    Feb 10, 2019
    Messages:
    10
    Likes Received:
    0
    I've seen this done before using skript on servers but I'm not sure how to start. All I can think of doing would be storing the exponent and coefficient seperately, but I'm not sure how to do that where the math is still all correct. Not asking for spoonfeed, just wondering how I should start.
     
  2. Goose

    Supporter

    Joined:
    Nov 23, 2019
    Messages:
    429
    Likes Received:
    30
    You can try storing the number in text variables, so this is an example
    Code (Text):
    1. set {_var} to "%2^53 * 2%"
    The variable {_var} now holds twice the 64 bit integer limit in text!
     
    • Like Like x 1
  3. 11thDoctor314

    11thDoctor314 Member

    Joined:
    Feb 10, 2019
    Messages:
    10
    Likes Received:
    0
    Yes, but if I used that, I wouldn't be able to do operations with it.
     
  4. Goose

    Supporter

    Joined:
    Nov 23, 2019
    Messages:
    429
    Likes Received:
    30
    Well then I don't think there is any other way to do it (maybe some way with binary)
     
    • Like Like x 1
  5. TPGamesNL

    Supporter Addon Developer Dev Programme

    Joined:
    Jan 20, 2018
    Messages:
    1,500
    Likes Received:
    107
    Medals:
    What exactly do you need it for?
     
    • Like Like x 1
    • Agree Agree x 1
  6. 11thDoctor314

    11thDoctor314 Member

    Joined:
    Feb 10, 2019
    Messages:
    10
    Likes Received:
    0
    Made a clicker server in 60 minutes as a joke, and it ended up getting semi-popular.
     
  7. TPGamesNL

    Supporter Addon Developer Dev Programme

    Joined:
    Jan 20, 2018
    Messages:
    1,500
    Likes Received:
    107
    Medals:
    First of all, numbers in Skript are stored as a java double. This means that their maximum value is about 1.8E308, but it has lost precision at that point. This could be an issue, depending on what you want: if players get far in the game, they probably get more clicks at once, so the number won't be increased by very small values anymore. If it does get increased by very small values (and those values actually make a difference over a period of time), then you'd need to find another solution. If the number is only increased by big numbers when the number itself gets larger, their won't be an issue. You just have to make sure that your scripts use Skript numbers, not integers, as they would cause an issue.
     
    • Like Like x 1
    • Funny Funny x 1
  8. 11thDoctor314

    11thDoctor314 Member

    Joined:
    Feb 10, 2019
    Messages:
    10
    Likes Received:
    0
    By skript numbers, do you mean variables that have a number value like {money::%player's uuid%}, or is there something I'm missing? My variables just cap at 9.22e18.
     
  9. TPGamesNL

    Supporter Addon Developer Dev Programme

    Joined:
    Jan 20, 2018
    Messages:
    1,500
    Likes Received:
    107
    Medals:
    Are you using integers or floats?
     
    • Like Like x 1
  10. 11thDoctor314

    11thDoctor314 Member

    Joined:
    Feb 10, 2019
    Messages:
    10
    Likes Received:
    0
    Integers, I'm not sure how to use floats with skript.
    Edit: Nevermind, I'm using numbers with decimals. It still caps at 9.22e18.

    Would I be able to manually edit the variable type in the variables file from "long" to something else?

    I've also seen games such as Antimatter Dimensions reach above 1.79e308, how could I do that?
     
    #10 11thDoctor314, Mar 31, 2020
    Last edited: Mar 31, 2020
  11. TPGamesNL

    Supporter Addon Developer Dev Programme

    Joined:
    Jan 20, 2018
    Messages:
    1,500
    Likes Received:
    107
    Medals:
    Can you try to set a variable to 10.1^19, then send that variable in chat / to console, and tell me the outcome.
    You can also store the number as 2 numbers, for example a and b, where the actual number would be a * (9.22E18)^b. If you want to use that system, I recommend you make some functions to add and remove to the number, so it'll be easier to use (you might also want a function to display the number).
     
  12. 11thDoctor314

    11thDoctor314 Member

    Joined:
    Feb 10, 2019
    Messages:
    10
    Likes Received:
    0
    the a and b was what i was thinking at first, where one is mantissa and one is exponent, so I can get up to 10^9.22e18.I figured out how it would work now, and I was planning on making it so a number 8 orders of magnitudes smaller just doesn't add anything.
     
Thread Status:
Not open for further replies.

Share This Page

Loading...