Home › Forums › How-to’s and Tips › Best 3 of 5 macro
Tagged: macros
This topic contains 2 replies, has 2 voices, and was last updated by JackBurton 1 year, 1 month ago.
-
AuthorPosts
-
June 12, 2014 at 10:53 pm #1445
Carl,
1st of all great work. I can tell that his project is a labor of love as well as a product for you. Nice to see the responsiveness and dedication.
…but enough sucking up:) I was wondering how one might make a script to select the top n dice of x (if possible). Our character generation is very generous and we select top 3 6-sided of 5 die rolls.Is this possible?
Thanks.- This topic was modified 1 year, 1 month ago by carl. Reason: Moved to more appropriate section
-
June 16, 2014 at 11:52 pm #1482
I’m not sure if the macro was/is supposed to output to the window but it didn’t seem to do so on V .51. Instead it rolls the 5 dice with no output to the chat so I’m using the 5 die and just taking the top 3.
While I’m on the subject of dice is there a way to adjust the time the dice stay on the desktop? When I was testing the macro I thought it would be cool if they stayed longer.
Thanks.
DBS
-
June 13, 2014 at 1:24 am #1446
You could do that by rolling a number of dice, sorting in ascending order, and then adding all except the last two.
var dice = [1d6, 1d6, 1d6, 1d6, 1d6]; var drop = 2; dice.sort(function(a, b){return b-a}); var total = 0; for(var i = 0; i < dice.length - drop; i++) { total+=dice[i]; };
You should be able to copy-paste this directly into a GenMacro.
To change the number or type of dice rolled, modify the dice arrray. E.g. var dice = [1d12, 1d8, 1d6];
To change the change the number of dice to drop, modify the drop variable. E.g. var drop = 1;
This will get easy as more presets and notations are added to the macros.
- This reply was modified 1 year, 1 month ago by carl.
-
AuthorPosts
You must be logged in to reply to this topic.