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

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

11thDoctor314

Member
Feb 10, 2019
10
0
0
18
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.
 
You can try storing the number in text variables, so this is an example
Code:
set {_var} to "%2^53 * 2%"
The variable {_var} now holds twice the 64 bit integer limit in text!
 
  • Like
Reactions: 11thDoctor314
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.
What exactly do you need it for?
 
  • Like
Reactions: 11thDoctor314
Made a clicker server in 60 minutes as a joke, and it ended up getting semi-popular.
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
Reactions: 11thDoctor314
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.
 
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?
 
Last edited:
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?
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).
 
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.
 
Status
Not open for further replies.