Creating Random Dice Numbers in PDFs
Hi!
I do a lot of work for tabletop gaming companies and I'm hoping to develop a feature in InDesign where the exported PDF creates and displays a random number between say 1-20 inclusive. I was looking at setting this up in the InDesign file, but I've been directed to post this query here.
The random number would appear as though it was on the face of one side of a dice, and would be different every time you open the document.
I've had a bit of help from a JS savvy mate, and are using the following coding:
function d20() {
return Math.floor(Math.random() * 21);
}
the trick I'm facing is associating this function with a particular text box. I've added it to the JS Document Scripts, just how do I get it to display in the document?
Thanks heaps for your help.
