RPTools.net

Discussion and Support

Skip to content

It is currently Tue Jun 27, 2017 10:36 pm 






Reply to topic  [ 2 posts ] 

Previous topic | Next topic 

  Print view

Author Message
User avatar  Offline
Deity
 
Joined: Tue Jul 01, 2008 6:48 pm
Posts: 6237
 Post subject: Dice Rollers for Godlike, Wild Talents, and REIGN
PostPosted: Mon Dec 15, 2008 2:24 pm 
Hello all. I've been digging deep into MapTool lately to work on some D&D stuff, but I needed a break from polishing that particular...apple...and started working on a dice roller for the One-Roll Engine games.

I don't know if anybody plays them, or if any roller code has already been posted, but I thought I'd share. For those who don't know, the mechanic for those games is to roll a pool of 2 to 10 d10's, and then count matches. If you get a match (two dice coming up the same number), you have a set. Set have "width" - in other words, how many dice matched; and "height", or what number was matched.

So if you rolled and had two dice come up 10, you would have a set that was 2 wide and 10 high, or a "2x10" set.

Anyway, so I wrote a macro that rolls some number of d10s and figures out how many sets.

Code:
[h:resList=""]
[h:outputList=""]

[h,count(dicepool),CODE:
{
[h:resList=setStrProp(resList,"roll"+roll.count,1d10)]
}]

[h:sets1=0]
[h:sets2=0]
[h:sets3=0]
[h:sets4=0]
[h:sets5=0]
[h:sets6=0]
[h:sets7=0]
[h:sets8=0]
[h:sets9=0]
[h:sets10=0]

[h,count(10),code:
{
   [h:sets1=sets1+if(getStrProp(resList,"roll"+roll.count)=="1",1,0)]
   [h:sets2=sets2+if(getStrProp(resList,"roll"+roll.count)=="2",1,0)]
   [h:sets3=sets3+if(getStrProp(resList,"roll"+roll.count)=="3",1,0)]
   [h:sets4=sets4+if(getStrProp(resList,"roll"+roll.count)=="4",1,0)]
   [h:sets5=sets5+if(getStrProp(resList,"roll"+roll.count)=="5",1,0)]
   [h:sets6=sets6+if(getStrProp(resList,"roll"+roll.count)=="6",1,0)]   
   [h:sets7=sets7+if(getStrProp(resList,"roll"+roll.count)=="7",1,0)]
   [h:sets8=sets8+if(getStrProp(resList,"roll"+roll.count)=="8",1,0)]
   [h:sets9=sets9+if(getStrProp(resList,"roll"+roll.count)=="9",1,0)]
   [h:sets10=sets10+if(getStrProp(resList,"roll"+roll.count)=="10",1,0)]
}]

[h,for(x,0,9),CODE:
{
   [h:setSlot=x+1]
   [h:sets=eval("sets"+setSlot)]
   [h:setString=if(sets>=2, sets+"x"+setSlot, "")]
   [h:outputList=if(setString!="", listAppend(outputList, setString), outPutList)]
 }]

[IF(outputList!=""),CODE:
{
   Rolling [r:dicepool+"d"]: [r:outputList]
};
{
   Rolling [r:dicepool+"d"]: No sets.
};]
   


Please feel free to critique, compliment, or borrow as you feel appropriate! It's not perfectly elegant, but there are some list functions that don't yet exist that would have made it simpler. Fortunately, you can never roll more than 10 dice, so there's a limit to possible sets, which makes this doable. Anyway, it seems to work, so enjoy.

_________________

What I'm Working On

MapTool Tutorials:
Introduction to Tokens
Introduction to Properties
Introduction to Macro Writing
Introduction to Light and Sight


Top
 Profile  
 
 Offline
Kobold
 
Joined: Sat Sep 12, 2015 4:08 pm
Posts: 1
 Post subject: Re: Dice Rollers for Godlike, Wild Talents, and REIGN
PostPosted: Sat Sep 12, 2015 4:10 pm 
I Like it but is there any way it can show each individual roll?


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

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 are 5 users online :: 0 registered, 0 hidden and 5 guests (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 5 guests





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

Style based on Andreas08 by Andreas Viklund

Style by Elizabeth Shulman