RPG Maker MV
CXJ Core - BigInt

Sometimes you need larger numbers, and sometimes you need really big numbers. And sometimes, you need enough numbers to make any computer crash. Well, this script gives you the option to create really big numbers, and do simple calculations with.

The BigInt object is now part of the CXJCore line of scripts. Even though it is part of it, it's still a stand-alone script, and can even be used outside of RPG Maker MV.

Download (31.33 kB, 5 times downloaded)

This is a simple helper plugin, meant for those with a little bit more programming experience. As such, the end-user is supposed to place this as high as possible. As it doesn't touch any JavaScript class, you can freely use it as you want.

Of course, developers are fully authorized to integrate the code into their own scripts, no strings attached.

You can use this BigInt object by creating a new CXJScripts.CXJCore.BigInt instance. If CXJ Core is installed and the Namespace parameter is set, you can also call this object from the chosen namespace.

The BigInt object uses an array to store the big numbers, and each row is stored as a string. As such, doing simple additions and subtractions isn't a simple task, which is why it has several new methods that do the job for you. Do know that because of this, the BigInt object might be a bit slower than regular integers.

When creating a new BigInt object, you can set a default value. From there, you can use add, sub, multiply, divide and mod to modify the current object. Note that it doesn't create a new object, but it does return the current object each time, so you can chain commands. This also does mean that every time you do a modification, the original object does get modified, so if you want to keep the original, you'll have to clone the current object.

Finally, you can output the current BigInt as a string using toString.

Methods

CXJScripts.CXJCore.BigInt(value)

Constructor

This creates a BigInt object, allowing you to create really big integers.

Arguments:

valueoptional The value to set this BigInt with

CXJCore.BigInt.prototype.add(value)

Adds the value the current BigInt

Arguments:

valueThe value to modify this BigInt with

Returns: The current BigInt object


CXJCore.BigInt.prototype.sub(value)

Subtracts the value from the current BigInt

Arguments:

valueThe value to modify this BigInt with

Returns: The current BigInt object


CXJCore.BigInt.prototype.multiply(value)

Multiplies the current BigInt with a value

Arguments:

valueThe value to modify this BigInt with

Returns: The current BigInt object


CXJCore.BigInt.prototype.divide(value)

Divides the current BigInt with a value

Arguments:

valueThe value to modify this BigInt with

Returns: The current BigInt object


CXJCore.BigInt.prototype.mod(value)

Gets the modulus of the current object

Arguments:

valueThe value to modify this BigInt with

Returns: The current BigInt object


CXJCore.BigInt.prototype.compare(value)

Compares two values

Arguments:

valueThe value to compare this BigInt with

Returns: 1 if the current object is bigger than the value, -1 if smaller, and 0 if equal


CXJCore.BigInt.prototype.clone()

Clones the current object

Returns: A BigInt object


CXJCore.BigInt.prototype.toString()

Converts the object to a string

Returns: A string with the value of the current object

Creator: GaryCXJk

Release date: 2017-07-17

Downloads: 5

License: ISC License

Optional compatibility: