We use Cookies to help personalize and improve Roll20. For more information on our use of non-essential Cookies, visit our Privacy Policy here.
Accept
Advertisement Create a free account

Square Root

1495148658
Is there a square root function in standard Roll20 macro language?  I need it to reproduce an AD&D2E table that has to do with psionics and Mental Armor Class.
1495148745
Silvyre
Forum Champion
Yup! Check out: Math Operators and Functions . [[ 144**0.5 ]] = 12
1495149049
found it.  thanks. :D
Your function sounds very interesting!  In what way is this table related to square roots?
1498049662
It's been a long month and I don't remember. I think I was actually mistaken.
That's cool. I know that (but not how - I haven't absorbed that yet lol) square roots are sometimes involved in statistical functions, and dice tables are based on some kind of statistical structure - whether real or fabricated (in the sense that they are supposed to be random distributions).  So, that is why I got interested.  I think that square roots have more to do with calculating a distance function between data points to see how much they deviate from "the norm."  Maybe someone who actually understands statistics could explain this :D.  AnyWho.... the idea sounded very interesting!
1498056567
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
They are also very useful in games that use a third dimension for mapping, as you can get range from distance and elevation by way of the Pythagorean Theorem.
1498072987
If you can figure out how to formulate mental armor class from AD&D 2.5E, I'd be much obliged. It's nice to get some mathnets in here.
1498073113

Edited 1498073332
I believe it's found in "Player's Option: Skills and Powers". Like I said, it's been a long month so I'm not quite sure that's correct. When I get home, I can post what I have so far for mental AC and also MThAC0.
1498078939

Edited 1498079001
keithcurtis said: They are also very useful in games that use a third dimension for mapping, as you can get range from distance and elevation by way of the Pythagorean Theorem. That makes sense.  Tabulating those values (and linearly scaling them when necessary) would certainly beat calculating them during the game :D.  Now, about the fourth dimension... ;)
1498094536

Edited 1498094597
As my players recently took on a flying opponent (a manticore), and may encounter more flying foes in the future, I concocted the following macro to compute the true range of flying targets: Distance to target: [[ floor( ( [[(?{Horizontal Range (in feet)|0}**2)]] + [[(?{Vertical Height (in feet)|0}**2)]])**0.5) ]] **feet** I chose to floor() the final result to get a nice short number instead of something like 140.84643418549... :-)
1498094722
The Aaron
Forum Champion
API Scripter
Nice!  If you want more decimal places, you can multiply by a power of 10 inside the floor and divide by it outside the floor:
1498094905
Thanks for the improvement, TheAaron!