Thursday, December 27, 2007

Snippet: Die Roll

This snippet replaces instances of #d# in a text block with random numbers generated similarly to table-top gaming dice rolls. The random numbers are generated the same way that a die would be rolled in this situation (e.g. "3d6" equates to "roll random 1 to 6 three times; add all three rolls").

Click here to download the snippet: Die Roll

Sample Input:
I have a +1d3 Ring of Codefu, but I may be inclined to part with it for say... 3d20 gold? Hmmm...

Sample Output:
I have a +3 Ring of Codefu, but I may be inclined to part with it for say... 13 gold? Hmmm...

No comments: