Tabletop Simulator

Tabletop Simulator

Holy Roller - scripted dice roller
30 Comments
Capt. Bollocks 2 Apr, 2023 @ 6:40am 
Love this roller! Is there a way to print the dice roll result in the GUI/Game Log?
Aracnes 24 Apr, 2022 @ 7:17am 
Used this yesterday with d8s. There is definetly something not working because I kept rolling far over statistics. On several 6x d8 tests on a 5+ (50%) for example I was constantly obtaining 5 successes. The value 8, which in my game represents a critical success, was also happening way too frequently. Not sure if there is an effect on how the initial position of the dice or such.
chaylafaysky 5 May, 2021 @ 5:02pm 
It looks like the author has not posted here in over a year, but I figure that I'll try anyways... I am a DM who plays D&D with a couple of close friends - I rather like this roller,.. but my friends often have really bad rolls with their dice (their rolls are generally like 50% below the average), and they have been having a hard go on some of the tougher encounters - since I (as the DM) always roll in the open, where my players can see my rolls, I cannot "fudge" the numbers to help them out in any encounters. So I was wondering if it was possible to script a copy of this roller to give out numbers that are above average about 2x more often than getting lower rolls - I am not looking for a roller that rolls max most of the time... just a slight boost, to help out my players who often roll poorly.
Buddy ☩ 6 Feb, 2021 @ 2:09pm 
Hey I planned to use these for my session today but as of like 5 minutes before the session. An error is showing up. We have done literally nothing to the rings. It says Error in Script, Custom Model Bag, onCollisionEnter fuction: Object reference not set to an instance of an object
Top C. Cret 30 May, 2020 @ 10:05am 
Hey! Big fan of the roller but i was curious what the script is to possibly add back in the rolling animation it did before? I am thinking of starting a game with my group but i am not sure they would use the roller if they didnt think it was actually rolling the dice to randomize them. I know it is but they enjoy visual feedback like that.
MusicNeverSleeps 10 May, 2020 @ 9:28pm 
Is there a ways to make it so the GUID isn't changed once an item enters the halo?
MareNostrum 14 Apr, 2020 @ 6:46pm 
Well, I love your dice roller. I just wish that it printed a sum of all the dice rolled, like Roll-O-Matic does.
MrStump  [author] 12 Apr, 2020 @ 4:01pm 
Yep! Just another in a long line of tools of dubious value. But you forgot to point out that it also looks pretty ugly, so I'm going to have to give your review a 4/5.
Quizzelbuck 12 Apr, 2020 @ 1:11pm 
This is literally no better than just hitting the R Key. If it doesn't hold the dice, and then spit them out on request permanently then whats the point?

I can just box 4 or what ever dice, with the mouse. This is the R key with extra steps.
Fingler 31 Dec, 2019 @ 8:19am 
These color changing dice need to be lifted and let go to update the colors after using your mod, would it be possible to have the roller somehow update the dice to force the color change? Gif [i.imgur.com]
entr0py 7 Mar, 2017 @ 7:13pm 
+1 vote for Roll-a-Matic's print function.

Thanks again Mr. Stump
MrStump  [author] 6 Mar, 2017 @ 6:29pm 
Updated to the new dice randomizer, removing the roll system from before. Nice and tidy.
Kohda 26 Feb, 2017 @ 7:37pm 
ah silly me that was exactly it, auto run scrips was off, thank you
MrStump  [author] 26 Feb, 2017 @ 8:49am 
I had intended to take another run at this one for a while now Kohda, so sure I will. I'm glad you've enjoyed it (up until it stopped working). Also, check to make sure the host has scripting enabled in their table options!
Kohda 26 Feb, 2017 @ 1:39am 
Dear Mr. Stump, we, my gaming group and I, adore, and I mean ADORE your dice roller, we use it in damn well every single mod that uses dice rolling and we love it. But it seems to not be working anymore, the roller now acting like a simple bag at the moment, I hope that you can find it in your heart to fix this, we would be ever more thankful! again, thank you for this wonderful thing
MrStump  [author] 11 Dec, 2016 @ 7:12pm 
To clarify, I worked this out with Tragic (ty Tragic). Here is the solution if you want the dice to come out rotated. Just replace the current snip of code with this new section

--Loop, runs through each item in the bag, sets its position and rotation for its destination, and pulls it out
local addRot = math.random(0,359)
for i, v in pairs(contents) do
--This is how we determine the position of each individual removed item. (see end for more)
local xp = xPos + math.sin( (addRot+(spokes*i)+yRot)*0.0174532 ) * radius
local yp = yPos + height
local zp = zPos + math.cos( (addRot+(spokes*i)+yRot)*0.0174532 ) * radius
MrStump  [author] 11 Dec, 2016 @ 6:17pm 
It depends what you mean. For example, do you mean "If you use 4 dice is there a way to have them not come out North East South West but instead SouthEast, SouthWest, etc etc sometime? The answer is yes. Where it has (spokes*i), add math.random(0,360) + (spokes*i). That should add a random change on the angle from 0-360 degrees it will add to the rotation of the starting point of where the first die is placed. The dice WILL still be placed out evenly to avoid bumping into eachother.

Or do you mean the same dice end up at the same point over and over? That's an easy one. add a self.shuffle() right before takeObject() takes everything out of the bag to shuffle up the dice first.
Tragic 11 Dec, 2016 @ 7:45am 
is there anyway to randomise the "spokes" that the die fall out.. like if you throw one die, it always lands in the same place relitive to the rotation of the roller bag... you can rotate the bag and it will drop at a new position. Gets kinda old seeing a few die all land in the same spot when rolling low numbers of die. I've been trying to get it to randomly pick a "start point" but can not work it out. so yeah.. i guss this is a sugestion : )
Kohda 24 Aug, 2016 @ 1:19am 
Thank you thank you thank you, this is by far the BEST tool to have in your toolbox for this, a thousand thank yous more
MrStump  [author] 13 Aug, 2016 @ 7:45am 
Gave up on the math solution. While I believe the maths might be solvable in Lua, it is not worth it. Not when I am already getting randomized results.

I may re-write the rolling to use roll(), then position them down so they don't scatter all over. (roll throws them in the air)
MrStump  [author] 11 Aug, 2016 @ 5:37am 
I responded on the forums as well. I ran more tests on the currently published version and it honest gave me better distribution than hand-made rolls in side-by-side tests up to a few hundred rolls (when I got sick of rolling). The physics engine does a good job of randomizing it if I put spin on the dice.

As for the mathmatical solution, here is how I apply rotation: http://pastebin.com/1fEkiuA5

You can see commented out just some of the other solutions I have attempted.
spheniscine 11 Aug, 2016 @ 2:51am 
Just to note that I have submitted a correction to the code you mentioned in the Berserk forums. I *hope* it is enough; if there are other flaws or problems I might have missed them.
MrStump  [author] 10 Aug, 2016 @ 10:48am 
PS) If anybody already has this solution and would like to save me huge amounts of trouble, feel free to speak up.
MrStump  [author] 10 Aug, 2016 @ 10:48am 
Thanks for bringing this up spheniscine. Good news, problem is fixed, I just need to impliment it. The easy solution was to apply a "random" torque to each die as it falls to the table. This brought the distribution to just about even: http://screencast.com/t/6Kg5EJF5chnF

I am also working on a solution involving quats with the help of some nice internet people. Basically, creating a random quat meeting certain requirements and then converting it to Euler angles. Fun stuff, and over my head math-wise. But the good news is even if I don't get it, the dice rolls are quite random now, if not quite perfect.
MrStump  [author] 10 Aug, 2016 @ 5:47am 
There is definitely something up with the distribution of the rolls. Using my old solution, I set it to automatically roll and re-roll the dice. Results here: http://imgur.com/a/fuQMZ HEAVILLY weighted towards 2 and 5 (which I assume are the poles). So you are right about the problem. I am going to give your mathmatical solution you posted a try.
spheniscine 10 Aug, 2016 @ 4:44am 
Forget what I said earlier; I think I shall ask an expert first.
MrStump  [author] 9 Aug, 2016 @ 9:20pm 
I have thought of a trick to possibly track who rolled a bit better. I may revisit this solution for a re-work.
MrStump  [author] 9 Aug, 2016 @ 9:17pm 
Done. It will only work reliably with basic dice. I did not test it with customs. Also, tracking who dropped the dice was difficult because their GUID changes when leaving the halo. So I just have it keep track of the last person to drop something and print their steam name as the roller. But there is a couple of seconds between drop and print, so keep in mind the roller name may be wrong sometimes.

For those reasons, the feature is off by default. I made a simple variable you can edit at the top of the code to activate the feature.
entr0py 9 Aug, 2016 @ 8:02pm 
This is what ive been waiting for !.. dice rolling in this game has always been kinda wonky.
I really like this. Thank you.
Anyway to post the roll (with player steam name) to chat?
Azhtek 9 Aug, 2016 @ 1:23pm 
This is excellent. Thank you.