Is there a full syntax help file?

Forgive me if this has been asked, or answered, previously. I’ve looked but can’t find what I need…

I’ve gone through the tutorials, and the Help files, but still can’t find what I need.

I’m trying to create/automate character sheets ready playing.
I have worked out, or managed to steal, the syntax for most of the maths I need.
But, I’ve ran into a block on spell casting.

I need to use the “min” function, but can’t work out its syntax.
I want a lvl d8 + lvl where the lvl is limited to 5. I know the min fuction will do this, I just can’t work out how to use it.

Any assistance please, either with min, or where I can find a full list of functions and their syntax?

Cheers in advance!

Hi @Legion1901

Try min(lvl, 5)

For further information on the mathematical functions available in Astral, have a look at the Math.js documentation on the internet.

Cool Thanks for the help. I’ll try it.

I’m going to ask the obvious question: is the Math.js part of a web address? Or a search term?

It’s a full list of terms and syntax that I would really like to find!

Hey… if this is of any use to anyone.
After much experimentation, I have worked out the almost random syntax for my problem.

!({Lvl ? min(5, Lvl ):5} )d8+{Lvl ? min(5, Lvl ):5} )
Where Lvl is the level of the character. I don’t know why the min function needs to start with the stat it is referring back to, but it does. The 1st five is the comparator, I think, the second the result if the stat (in this case Lvl) is more than 5.

There are so many spells dependant on “level number of die upto a maximum of…” And this little phrase would seem to make for a very quick automation of those spells.

Hope some one else finds this useful!!

Just using min will give you the result you need. Since Lvl will never be 0, the result will always be min(5,Lvl), so testing just slows the sheet down.

Yep! Got it! Java Script Math syntax is an arse… it really doesn’t make a massive amount of sense until you know what it does!
So thanks for the help!
Trying, failing, trying more, working out an answer, then someone explaining what your answer does, is very good way to learn this!

1 Like

Glad to have been of some help.

// Closing as resolved