Description
Math command would be a perfect way to perform an operation on a number and get the result. This could also give you an option to use math functions, such as calculating a cosine/sine for an angle, getting a square root of a number, or even raising a number to a particular power.
Why would it be useful?
There is currently a way to operate on a number using the «scoreboard players operation» command, which although pretty useful, is at the same time not as advanced as the Math command could be. Scoreboard operation involves creating a so-called "Dummy" player and setting a dummy score to a value, e.g. «scoreboard players set TEN dummy 10», the math command would allow a more straightforward way, by simply specifying a number. Another advantage would be the fact that the Math command returns the result and doesn't store it automatically.
You can think of scoreboard operations as the "*=" operator, whereas the Math command as the "*" one.
Possible Implementation(s)
Possible implementations of the Math command with some
example usage.
/math operation
Lets you operate on a number, such as:
/math operation divide 4 2 //returns 2
This could be equal to such code:
return 4/2;
/math function
Lets you use a math function, such as:
/math function sqrt 9 //returns 3
Whereas this could be equal to such code:
return Math.sqrt(9);
Please sign in to leave a comment.
0 Comments