New web toy: Mobile dice!

“NO SOONER DO YOU DEFEAT THE TROLL THAN AN UMBER HULK APPEARS! ROLL INITIATIVE!” Photo courtesy Douglas S. Smith, found on wp

Surely it has happened to you: you’re out somewhere and need a random number, or a whole bunch of them. For me, this mostly happens at restaurants, when I would like to consult an Infallible Oracle as to which of N tasty possibilities is right for me on a given day. But maybe you’re playing Dungeons and Dragons in free-fall (this makes conventional dice less than useful). Perhaps you have found yourself diceless and kidnapped by a capricious yet mathematically sophisticated evil overlord, who will not free you until you have completed a Monte Carlo simulation by hand. I would like to help you, and if you’re that last guy I mentioned, buy you a drink.

Text “rolldice somestuff” to 41411, where somestuff is either a number or a D&D-style specification of how many dice to roll, and how many sides each die has. If you say just one number, you’ll get a reply with a random number between 1 and your number, inclusive, so sending “rolldice 6″ is like rolling a single, ordinary six-sided die; “rolldice 3″ will help you decide among the apple-glazed pork chop, the mahi-mahi on pan-fried noodles, and the five-spice steak. To use a D&D-style dice specification, put a “d” between the number of dice and the number of sides, so you would say “rolldice 3d10″ to get three random numbers between 1 and 10 (”three ten-sided dice”), or “rolldice 3d6″ to roll up your character’s stats old-school in that aforementioned free-fall role-playing scenario.

The way this was done is fairly cool, by the way: I used the free, ad-supported web service TextMarks to handle all the SMS-gateway logic, and then threw together a simple cgi script to handle the dice-rolling logic. Setting aside the time I spent figuring out that my newly-installed FTP client was set up wrong and mangling my script, the whole exercise took less than half an hour, which is nothing short of amazing – TextMarks 41411 is a marvel of simplicity.

3 Comments

  1. Dad:

    Do “std txt chrgs apply” mean no charge if you have a text plan? Otherwise, this could be very useful to say a superhero who has to decide which catastrophopic event to prevent when facing several at the same time.

  2. Colin:

    It does in fact mean that these are just vanilla text messages, and that if you have a text plan, it will cover your use of this service.

  3. Colin:

    I haven’t seen any superheroes show up in my user log yet. There’s a good reason for that! The only superhero allowed to go on duty without a randomizer is The Randomizer, whose superpower is generating truly random numbers (odds are good that you don’t want his help anyway). If Aquagirl dons her cape and walks out of the house without her Game of Life spinner, and then succumbs to analysis paralysis when trying to decide which evildoer to smite, she might find her union card pulled.

Leave a comment