Aeroplankton Enthusiasts Society

Intangible Products for an Ephemeral World

Unicode 5d6 Roller via PHP/JS

For myself and others with a disproportionate amount of nerdy, a (hopefully) lightweight digital replacement for those bereft of dice.  Using convenient (if not cross compatible) HTML references for UTF-8/Unicode Symbols and some simple PHP or JavaScript we can roll a randomized set of five six-sided die with each browser refresh.

The HTML

First we build a HTML container for our die rolling script.  While the CSS style adds unnecessary weight, it does allow for greater readability:

via PHP

A quick for loop and some (uncouth) shorthand allow us to push out five randomized UTF-8 symbols ranging between one and six.  Should we desire more or less die in our roll, we simply adjust the loop accordingly:

via Javascript

Once again, a simple loop and random zero to five append in shorthand.  This time via the JavaScript fuctions document.write(), math.floor(), and math.random():

Once we’ve pasted our script of choice, into our container we can minify the lot and upload someplace for all our tabletop gaming or dice rolling needs.

© 2017 Aeroplankton Enthusiasts Society, All rights reserved.