RPTools.net

Discussion and Support

Skip to content

It is currently Tue May 30, 2017 4:16 am 






Reply to topic  [ 1 post ] 

Previous topic | Next topic 

  Print view

Author Message
 Offline
Kobold
 
Joined: Tue Oct 27, 2009 2:04 pm
Posts: 3
 Post subject: EarthDawn Die Rolling Function
PostPosted: Tue Oct 27, 2009 2:31 pm 
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) {
row.label="ED("+a+")";
var roll = Math.floor(Math.random()*a)+1;
var result = roll;
if (roll == 1) {
row.setForegroundColor(255,0,0);
}
while (roll == a) {
roll = Math.floor(Math.random()*a)+1;
result = result + roll;
row.setForegroundColor(0, 255, 0);
row.label="ED("+a+")+";
}
return result;
}


Top
 Profile  
 
Display posts from previous:  Sort by  
Reply to topic  [ 1 post ] 

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:

Who is online

In total there is 1 user online :: 0 registered, 0 hidden and 1 guest (based on users active over the past 5 minutes)
Most users ever online was 243 on Sun Nov 04, 2012 6:14 am

Users browsing this forum: No registered users and 1 guest





Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group

Style based on Andreas08 by Andreas Viklund

Style by Elizabeth Shulman