Library Token: Dice Box

These are tools and utilities that make it easier to run games. This includes Lib: macro tokens dropped into MapTool to manage the game, a conversion file for CharacterTool to allow use in MapTool, or just about anything else you can think of -- except graphics with macros and anything specific to a particular campaign framework. Those are already covered by the Tilesets subforum and the Links and External Resources forum.

Moderators: dorpond, trevor, Azhrei, giliath, Gamerdude, jay, Mr.Ice

User avatar
Rumble
Deity
Posts: 6235
Joined: Tue Jul 01, 2008 7:48 pm

Re: Library Token: Dice Box

Post by Rumble »

A user discovered a significant (as in, "sonovabitch!") bug: when you selected the "each die" option, d6's were being evaluated as d4's.

I've fixed it, and the new version is available here:

Requires MapTool 1.3.b66
http://www.houseofgenius.com/files/mtfw ... _v31.rptok

For those who are not on 1.3.b66 yet, here's a b63-compatible version
http://www.houseofgenius.com/files/mtfw ... _b63.rptok
Last edited by Rumble on Wed Jul 21, 2010 5:32 pm, edited 1 time in total.

john anderson
Kobold
Posts: 6
Joined: Fri Jun 25, 2010 11:26 am

Re: Library Token: Dice Box

Post by john anderson »

Hi and first of all can I say how great both RPtools and Dice Box are.

I've been playing around with Dice Box, and I was wondering how to make it simpler for use as a straight d6 dice pool roller. By simpler, I mean the following...

Reduce the menu to just d6s
Remove the Modifier, Target, Explode, Show Results To (so there are no secret rolls) and Tooltip Info options
Only output the results as 'x' number of 'successes' (each d6 roll greater than or equal to 4) and to show each dice roll (ideally without having place the mouse over the output AND to have any 6s rolled be highlighted in another colour


Too much on the first visit?
:)
John

User avatar
Rumble
Deity
Posts: 6235
Joined: Tue Jul 01, 2008 7:48 pm

Re: Library Token: Dice Box

Post by Rumble »

john anderson wrote:Hi and first of all can I say how great both RPtools and Dice Box are.

I've been playing around with Dice Box, and I was wondering how to make it simpler for use as a straight d6 dice pool roller. By simpler, I mean the following...

Reduce the menu to just d6s
Remove the Modifier, Target, Explode, Show Results To (so there are no secret rolls) and Tooltip Info options
Only output the results as 'x' number of 'successes' (each d6 roll greater than or equal to 4) and to show each dice roll (ideally without having place the mouse over the output AND to have any 6s rolled be highlighted in another colour


Too much on the first visit?
:)
John
Stripping the dice box down would be taking the hardest possible route to what you want, IMO. Something like the macro below is a much more direct route:

Code: Select all

[h:status = input("numDice|0|Dice Pool Size")]
[h:abort(status)]

[h:numSux = 0]

[h:individualDice = ""]
[h,count(numDice),CODE:
{
   [thisroll = 1d6]
   [individualDice = listAppend(individualDice, thisroll)]
   [if(thisroll >= 4): numSux = numSux + 1]
}]
[h:outputDisplay=""]

[h,foreach(die, individualDice),CODE:
{
    
    [if(die == 6): outputDisplay = strformat("%{outputDisplay} <font color=red><b>%{die}</b></font>"); outputDisplay = strformat("%{outputDisplay} <font color=black>%{die}</font>")]
}]

[h:finalOutputDisplay = strformat("[%{outputDisplay}]")]

<b>[r:numSux] Success[r:if(numSux>1,"es","")]</b>: [r:finalOutputDisplay]
It prompts for the size of the dice pool, and then displays the successes and rolls (with 6's highlighted in red).

john anderson
Kobold
Posts: 6
Joined: Fri Jun 25, 2010 11:26 am

Re: Library Token: Dice Box

Post by john anderson »

Hey that's cool. Thanks for that, although I do miss the pretty graphics :)
John

Malekith
Giant
Posts: 245
Joined: Wed Jan 07, 2009 4:36 pm
Location: Gloucester, England
Contact:

Re: Library Token: Dice Box

Post by Malekith »

ah, shame I missed this. I could hae posted the macro code I have for my Warhammer (basic) Framework.
That makes me wonder - could it work in a frame??.... Hmm I should go back and look at it now I have better knowledge of MT.

Mal

EDIT:
Screw it, I went and found the old thread.
Here
And the code (which allows for 2 different rolls in one and setting any target number):
Here
[h: Input(
"UnitRoll|1|Number of unit dice to roll",
"UnitTN|2, 3, 4, 5, 6|Unit's Target Number|LIST|select=2 Value=string",
"SgtRoll|1|Number of sergeant dice to roll",
"SgtTN|2, 3, 4, 5, 6|Sergeant's Target Number|LIST|select=2 Value=string"
)]

[h: UnitWins = 0]
[h: UnitFailures = 0]
[h: UnitSixs = 0]
[h: UnitOnes = 0]
[h: SgtWins = 0]
[h: SgtFailures = 0]
[h: SgtSixs = 0]
[h: SgtOnes = 0]

<b>Unit's Target Number:</b> [r: eval("UnitTN")]<br>
<b>Unit's results:</b><br>
[h, count(UnitRoll), CODE:
{
[h: Rawroll = 1d6]
[h: UnitSix = IF(Rawroll == 6, 1, 0)]
[h: UnitWin = IF(Rawroll >= UnitTN, 1, 0)]
[h: UnitFail = IF(Rawroll < UnitTN, 1, 0)]
[h: UnitOne = IF(Rawroll == 1, 1, 0)]
[h: UnitSixs = UnitSixs + UnitSix]
[h: UnitOnes = UnitOnes + UnitOne]
[h: UnitWins = UnitWins + UnitWin]
[h: UnitFailures = UnitFailures + UnitFail]
}]
<span color="green">[r: UnitWins] Successes (of which [r: UnitSixs] are 6s)</span> and <span color="red">[r: UnitFailures] Failures (of which [r: UnitOnes] are 1s)</span><br>

<b>Sergeant's Target Number:</b> [r: eval("SgtTN")]<br>
<b>Sergeant's results:</b><br>
[h, count(SgtRoll), CODE:
{
[h: Rawroll = 1d6]
[h: SgtSix = IF(Rawroll == 6, 1, 0)]
[h: SgtWin = IF(Rawroll >= UnitTN, 1, 0)]
[h: SgtFail = IF(Rawroll < UnitTN, 1, 0)]
[h: SgtOne = IF(Rawroll == 1, 1, 0)]
[h: SgtSixs = SgtSixs + SgtSix]
[h: SgtOnes = SgtOnes + SgtOne]
[h: SgtWins = SgtWins + SgtWin]
[h: SgtFailures = SgtFailures + SgtFail]
}]
<span color="green">[r: SgtWins] Successes (of which [r: SgtSixs] are 6s)</span> and <span color="red">[r: SgtFailures] Failures (of which [r: SgtOnes] are 1s)</span>
Mal

User avatar
CyrusStonecypher
Giant
Posts: 158
Joined: Thu Nov 26, 2009 1:22 am
Location: Columbus, IN, U.S.A.

Re: Library Token: Dice Box

Post by CyrusStonecypher »

In the first post the link to the b63 version is broken.


User avatar
CyrusStonecypher
Giant
Posts: 158
Joined: Thu Nov 26, 2009 1:22 am
Location: Columbus, IN, U.S.A.

Re: Library Token: Dice Box

Post by CyrusStonecypher »

It seems that Azhrei's patch to allow map exports for b63 kills the dice box.

A campaign filed loaded with MapToolLauncher.exe has a properly functional dice box. The same campaign loaded with the altered .bat for Azhrei's patch throws an error when dice are rolled with the dice box. The error message is attached.

I don't really expect this issue to be fixed (old build with a tweaked .jar) but thought I'd post it in case anyone else is still using Azhrei's patch for b63.
DiceBoxError.txt
(60.4 KiB) Downloaded 117 times

User avatar
Doc_Waldo
Giant
Posts: 108
Joined: Wed Sep 08, 2010 11:41 pm
Location: Boise, ID

Re: Library Token: Dice Box

Post by Doc_Waldo »

What is the "Explode?:" do? I have played around and can't figure out what it does. I searched the post for "explode" but couldn't make heads or tails. Thanks.
--DOC

User avatar
JonathanTheBlack
Dragon
Posts: 544
Joined: Mon Jun 28, 2010 12:12 pm
Location: I'm the worm...

Re: Library Token: Dice Box

Post by JonathanTheBlack »

Doc_Waldo wrote:What is the "Explode?:" do? I have played around and can't figure out what it does. I searched the post for "explode" but couldn't make heads or tails. Thanks.
Explode means you roll it again if it rolls the highest value on the die. Exploding dice work in two ways. Either it counts as a success and you roll it again or your roll it again and add the second roll to the first roll. Some rule systems let you keep rolling each time you "explode" while others allow it to only happen once.

Gamerdude
Cave Troll
Posts: 89
Joined: Thu Feb 04, 2010 12:17 am

Re: Library Token: Dice Box

Post by Gamerdude »

Hi...
I've finally decided to get up off my lazy butt and start working with MapTools...after downloading it all this time and never doing more than giving it a quick once over.

I love the dice box (have 3.1) but I'm having a problem... I think what I'm expecting the difference on 'Tooltip Info' between "totals" and "Each Die". I'm expecting "totals" to give me a simple total of everything, where as "each die" should list the result of each die separately like in a comma separated list. (8,4,10,7,9 vs 38).

I also notice that if I want to just change the number of dice, like how many d10's for WoD, I have to clear all the settings and then reset my target, explore tooltip info, and number of dice... and for large pools of dice it's a 'click fest'.

For the WoD game I play in it would be nice to just set Target:8, Each Die, GM Only, Explode... and then easily change the number (would be a bit faster too)

Thank you
Al B.
Al B. USAF RET.
*Chief Organizer and Bottle Washer - 'User Creations' Forum*

MT Framework Directory **LISTING** (UPDT 2012-02-10)

User avatar
kyuss11
Giant
Posts: 175
Joined: Thu Dec 23, 2010 1:12 am

Re: Library Token: Dice Box

Post by kyuss11 »

I was wondering if anyone could add a <image src='[r: tableImage("NewDice",1)]'></image> or something like it to show the pictures of the dice rolled,instead of the bland "Rolling 1d6+0: 6".I tried to figure it out myself,but have been unable to find the right spot in the drop-in to get the image.

User avatar
lmarkus001
Great Wyrm
Posts: 1867
Joined: Sat Mar 29, 2008 12:30 am
Location: Layfayette Hill, PA

Re: Library Token: Dice Box

Post by lmarkus001 »

kyuss11 wrote:I was wondering if anyone could add a <image src='[r: tableImage("NewDice",1)]'></image> or something like it to show the pictures of the dice rolled,instead of the bland "Rolling 1d6+0: 6".I tried to figure it out myself,but have been unable to find the right spot in the drop-in to get the image.
You want to modify the macro "RollDice". Here is a sample that references the default dice images. Note that this requires a non-standard D100 table (the images are in the Default library, you just need to build the table fromt hem).

EDIT: Updated to include D100 rolls and this will only show the die images if the tables are loaded, Tooltip Info: Each Die is checked, and "Exploded" is not checked, otherwise it shows numbers.
RollDice with Images

Code: Select all

[h:numD4=json.get(macro.args, "d4s")]
[h:numD6=json.get(macro.args, "d6s")]
[h:numD8=json.get(macro.args, "d8s")]
[h:numD10=json.get(macro.args, "d10s")]
[h:numD12=json.get(macro.args, "d12s")]
[h:numD20=json.get(macro.args, "d20s")]
[h:numD100=json.get(macro.args, "d100s")]
[h:mod=json.get(macro.args, "mod")]
[h:breakout=json.get(macro.args, "breakdown")]
[h:target = json.get(macro.args, "tn")]
[h:showTo = json.get(macro.args, "showTo")]
[h,if(json.contains(macro.args, "explodeDice")): exp = "e"; exp=""]
[H: jTables = json.get(getInfo("campaign"),"tables") ]

[h:d4array=""][h:d4roll=0]
[h:d6array=""][h:d6roll=0]
[h:d8array=""][h:d8roll=0]
[h:d10array=""][h:d10roll=0]
[h:d12array=""][h:d12roll=0]
[h:d20array=""][h:d20roll=0]
[h:d100array=""][h:d100roll=0]


[h,if(breakout=="eachRoll"),CODE:
{
   [H: imgStr = "<image src=%s />" ]
   [h,count(numD4),CODE:
  {
     [thisD4 = eval("1d4"+exp)]
     [d4roll = d4roll + thisD4]
     [IF(json.contains(jTables,"D4") && exp == ""): d4array=listAppend(d4array, strformat( imgStr, tableImage('D4',thisD4))); d4array=listAppend(d4array, thisD4)]
  }]
  [h,count(numD6),CODE:
  {
     [thisD6 = eval("1d6"+exp)]
     [d6roll = d6roll + thisD6]
     [IF(json.contains(jTables,"D6") && exp == ""): d6array=listAppend(d6array, strformat( imgStr, tableImage('D6',thisD6))); d6array=listAppend(d6array, thisD6)]
  }]
  [h,count(numD8),CODE:
  {
     [thisD8 = eval("1d8"+exp)]
     [d8roll = d8roll + thisD8]
     [IF(json.contains(jTables,"D8") && exp == ""): d8array=listAppend(d8array, strformat( imgStr, tableImage('D8',thisD8))); d8array=listAppend(d8array, thisD8)]
  }]
[h,count(numD10),CODE:
  {
     [thisD10 = eval("1d10"+exp)]
     [d10roll = d10roll + thisD10]
     [IF(json.contains(jTables,"D10") && exp == ""): d10array=listAppend(d10array, strformat( imgStr, tableImage('D10',thisD10))); d10array=listAppend(d10array, thisD10)]
  }]
[h,count(numD12),CODE:
  {
     [thisD12 = eval("1d12"+exp)]
     [d12roll = d12roll + thisD12]
     [IF(json.contains(jTables,"D12") && exp == ""): d12array=listAppend(d12array, strformat( imgStr, tableImage('D12',thisD12))); d12array=listAppend(d12array, thisD12)]
  }]
[h,count(numD20),CODE:
  {
     [thisD20 = eval("1d20"+exp)]
     [d20roll = d20roll + thisD20]
     [IF(json.contains(jTables,"D20") && exp == ""): d20array=listAppend(d20array, strformat( imgStr, tableImage('D20',thisD20))); d20array=listAppend(d20array, thisD20)]
  }]
[h,count(numD100),CODE:
{
    [thisD100 = eval("1d100"+exp)]
    [d100roll = d100roll + thisD100]
    [IF(json.contains(jTables,"D100") && json.contains(jTables,"D10") && exp == ""): d100array=listAppend(d100array, strformat( imgStr, tableImage('D100',if(thisD100>=10 && thisD100 != 100, floor(thisD100/10), "10" )))+strformat( imgStr, tableImage('D10',substring(thisD100, length(thisD100)-1)))); d100array=listAppend(d100array, thisD100)]
}]

[h:rolledDice=
 if(d4roll !=0, numD4+"d4"+"+", "")
+if(d6roll !=0, numD6+"d6"+"+", "")
+if(d8roll != 0, numD8+"d8"+"+", "")
+if(d10roll !=0, numD10+"d10"+"+", "")
+if(d12roll !=0, numD12+"d12"+"+", "")
+if(d20roll != 0, numD20+"d20"+"+", "")
+if(d100roll != 0, numD100+"d100"+"+","")
+mod]

[h:Values = 
  if(d4roll == 0, "", d4roll+"("+d4array+")"+"+")
+ if(d6roll == 0, "", d6roll+"("+d6array+")"+"+")
+ if(d8roll == 0, "", d8roll+"("+d8array+")"+"+")
+ if(d10roll==0, "", d10roll+"("+d10array+")"+"+")
+ if(d12roll==0,"",d12roll+"("+d12array+")"+"+")
+ if(d20roll==0,"",d20roll+"("+d20array+")"+"+")
+ if(d100roll==0, "", d100roll+"("+d100array+")"+"+")
+ mod]
};
{
[h:d4roll = if(numD4=="0",0,eval(numD4+"d4"+exp))]
[h:d6roll = if(numD6=="0",0,eval(numD6+"d6"+exp))]
[h:d8roll = if(numD8=="0",0,eval(numD8+"d8"+exp))]
[h:d10roll=if(numD10=="0",0,eval(numD10+"d10"+exp))]
[h:d12roll=if(numD12=="0",0,eval(numD12+"d12"+exp))]
[h:d20roll=if(numD20=="0",0,eval(numD20+"d20"+exp))]
[h:d100roll=if(numD100=="0",0,eval(numD100+"d100"+exp))]
[h:mod=number(mod)]

[h:rolledDice=
 if(d4roll !=0, numD4+"d4"+"+", "")
+if(d6roll !=0, numD6+"d6"+"+", "")
+if(d8roll != 0, numD8+"d8"+"+", "")
+if(d10roll !=0, numD10+"d10"+"+", "")
+if(d12roll !=0, numD12+"d12"+"+", "")
+if(d20roll != 0, numD20+"d20"+"+", "")
+if(d100roll != 0, numD100+"d100"+"+","")
+mod]

[h:Values = 
  if(d4roll == 0, "", d4roll+"+")
+ if(d6roll == 0, "", d6roll+"+")
+ if(d8roll == 0, "", d8roll+"+")
+ if(d10roll==0, "", d10roll+"+")
+ if(d12roll==0,"",d12roll+"+")
+ if(d20roll==0,"",d20roll+"+")
+ if(d100roll==0, "", d100roll+"+")
+ mod]
}]

[h:roll = d4roll+d6roll+d8roll+d10roll+d12roll+d20roll+d100roll+mod]
[h,if(target>0 && roll >target): success = "Success!"; success="Failed!"]

[r,if(showTo == "all"),CODE:
{
    [r:dbxOutputTo("all", "<span><i>Rolling "+rolledDice+"</i>:<b> <span title='<html>"+Values+"</html>'>"+roll+"</b></span> "+if(target > 0, success, "")+"</span>")]
};
{
   [r:dbxOutputTo("gm", "<span><i>Rolling "+rolledDice+"</i>:<b> <span title='<html>"+Values+"</html>'>"+roll+"</b></span> "+if(target > 0, success, "")+"</span>")]
}]
Last edited by lmarkus001 on Wed Oct 05, 2011 4:32 pm, edited 4 times in total.

User avatar
kyuss11
Giant
Posts: 175
Joined: Thu Dec 23, 2010 1:12 am

Re: Library Token: Dice Box

Post by kyuss11 »

I just replaced the RollDice macro with your code but there appears to be no difference in the chat,I do see the
[d4array=listAppend(d4array, strformat( imgStr, tableImage('D4',thisD4)))] as a modification.The chat however still shows
Rolling 1d4+0: 2

User avatar
lmarkus001
Great Wyrm
Posts: 1867
Joined: Sat Mar 29, 2008 12:30 am
Location: Layfayette Hill, PA

Re: Library Token: Dice Box

Post by lmarkus001 »

Ah yes, I only show the dice image in for the Tooltip when the option "Each Die" is selected. That is the only location individual die rolls are shown (well I guess if you chose to roll only a single d4 then technically that would be a single value too...).
Screenshot (tooltip is at the bottom)
Image

Post Reply

Return to “Drop-In Macro Resources”