Demon4x4
Nov 30 2004, 07:30 PM
Anyone have a good email dice roller script? I would love to have something that I could use in a shadowrun PBEM. I would like for it to have a form for 'player's email' 'gm email' 'subject' 'description of action' 'number of dice to be rolled' 'number of sides on each dice' and then a submit button that would send the results of the email to the gm, and a carbon copy to the player.
Ideally it would be a script that I could add onto my own website, and not having to use a listserv.
Anyone have anything like that?
Spookymonster
Nov 30 2004, 08:25 PM
Here's a quick-n'-dirty script I wrote a while ago. Feel free to monkey with it as needed:
CODE |
<html> <head> </head> <body onload="document.dieform.resultList.value = 0;"> <script type="text/javascript"> function rollDie() { var diePool = document.dieform.diePool.value - 0; var resultArray = new Array(diePool); for (var i = 0; i < resultArray.length; i++) { resultArray[i] = 0; var dieHold = 6; while (dieHold == 6) { dieHold = (Math.ceil(Math.random() * 6)); resultArray[i] += dieHold; } } document.dieform.resultList.value = resultArray.sort(compareNum); } function compareNum(a,b) { return a-b; } </script> <form name="dieform"> # of Dice: <input type="text" name="diePool" value="1" size="4" maxlength="4" /> <button type="button" id="roll" onclick="rollDie()">Roll</button><p/> Results: <textarea name="resultList" value="foo" rows="5" cols="25" /> </form> </body> </html> |