Arctan Function using scripts?

Im trying to make a very spesific thing in mv. But it requires the use of the inverse tangent function. Is there any way to get any functions like those using scripts? Spesifically where I could input 2 variables for the opposite and adjacent sides, then get the answer as another variable? If this isnt possible, would there be any other way to do it?
Sure, JavaScript comes with a built-in Math.atan2() function. So you do something like this:
JavaScript:
$gameVariables.setValue(101, 1000 * Math.atan2($gameVariables.value(102), $gameVariables.value(103)));
This sets variable 101 to atan2 of variables 102 and 103, multiplied by 1000. Variables get rounded to the nearest integer, so without the multiplication you'd just get 0 if the value was less than 0.5.
Sure, JavaScript comes with a built-in Math.atan2() function. So you do something like this:
JavaScript:
$gameVariables.setValue(101, 1000 * Math.atan2($gameVariables.value(102), $gameVariables.value(103)));
This sets variable 101 to atan2 of variables 102 and 103, multiplied by 1000. Variables get rounded to the nearest integer, so without the multiplication you'd just get 0 if the value was less than 0.5.
This works! The only thing is it returns the value in radians. How could I change the line so that instead of multiplying by 1000, the atan gets converted into degrees. Then var 101 gets set to the degree angle.
How could I change the line so that instead of multiplying by 1000, the atan gets converted into degrees
That's some fairly simple math. You can replace 1000 with 180 / Math.PI .
W! Thanks for the help!

Original thread: https://forums.rpgmakerweb.com/threads/arctan-function-using-scripts.177098/