Page 1 of 1

EarthDawn Die Rolling Function

Posted: Tue Oct 27, 2009 3:31 pm
by SinniusGreen
On my tabs, I've got a button for each step.
For example:
Step 1 is 1d4-2, and it's called by entering ED(4)-2
Step 10 is ED(10):ED(6)
Step 20, ED(20):ED(8):ED(6)
The function will re-roll max die rolls and add them together. Natural 1's will show up in red, and rolls that hit multiples show up in green.

If anyone can explain how to import saved tab(xml) files, that'd be great.

Here's my functions.js:

function registerFunctions() {
var map = new java.util.HashMap();
map.put("ED", step01);
return map;

function step01(a) {
var roll = Math.floor(Math.random()*a)+1;
var result = roll;
if (roll == 1) {
while (roll == a) {
roll = Math.floor(Math.random()*a)+1;
result = result + roll;
row.setForegroundColor(0, 255, 0);
return result;